MDL-31248 - lib - Retaining the old password key and creating a new cookie prefix.
This commit is contained in:
+5
-5
@@ -1016,14 +1016,14 @@ function set_moodle_cookie($username) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cookiename = 'MOODLEID_'.$CFG->sessioncookie;
|
||||
$cookiename = 'MOODLEID1_'.$CFG->sessioncookie;
|
||||
|
||||
// delete old cookie
|
||||
setcookie($cookiename, '', time() - HOURSECS, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
|
||||
if ($username !== '') {
|
||||
// set username cookie for 60 days
|
||||
setcookie($cookiename, rc4encrypt($username), time()+(DAYSECS*60), $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
setcookie($cookiename, rc4encrypt($username, true), time()+(DAYSECS*60), $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1043,15 +1043,15 @@ function get_moodle_cookie() {
|
||||
return '';
|
||||
}
|
||||
|
||||
$cookiename = 'MOODLEID_'.$CFG->sessioncookie;
|
||||
$cookiename = 'MOODLEID1_'.$CFG->sessioncookie;
|
||||
|
||||
if (empty($_COOKIE[$cookiename])) {
|
||||
return '';
|
||||
} else {
|
||||
$username = rc4decrypt($_COOKIE[$cookiename]);
|
||||
$username = rc4decrypt($_COOKIE[$cookiename], true);
|
||||
if ($username === 'guest' or $username === 'nobody') {
|
||||
// backwards compatibility - we do not set these cookies any more
|
||||
return '';
|
||||
$username = '';
|
||||
}
|
||||
return $username;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user