From 7d398ba62227cf77066585b47adfcb5188dd991b Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 30 Aug 2013 00:33:48 +0200 Subject: [PATCH] Use the real username in preferences and magic cookie instead of case-insensitive user input. Fixes 4616. --- lib/base.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/base.php b/lib/base.php index 2e6a37c9f4..c6e031e61d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -791,14 +791,15 @@ class OC { self::$session->set('timezone', $_POST['timezone-offset']); } - self::cleanupLoginTokens($_POST['user']); + $userid = OC_User::getUser(); + self::cleanupLoginTokens($userid); if (!empty($_POST["remember_login"])) { if (defined("DEBUG") && DEBUG) { OC_Log::write('core', 'Setting remember login to cookie', OC_Log::DEBUG); } $token = OC_Util::generate_random_bytes(32); - OC_Preferences::setValue($_POST['user'], 'login_token', $token, time()); - OC_User::setMagicInCookie($_POST["user"], $token); + OC_Preferences::setValue($userid, 'login_token', $token, time()); + OC_User::setMagicInCookie($userid, $token); } else { OC_User::unsetMagicInCookie(); }