mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Clean up the logOut and session destructon routines.
This commit is contained in:
parent
ee784c3663
commit
2f7fd967b2
@ -528,21 +528,26 @@ class Session {
|
||||
public static function destroy($removeCookie = true) {
|
||||
if(session_id()) {
|
||||
if($removeCookie) {
|
||||
$path = Config::inst()->get('cookie_path');
|
||||
$path = Config::inst()->get('Session', 'cookie_path');
|
||||
if(!$path) $path = Director::baseURL();
|
||||
$domain = Config::inst()->get('cookie_domain');
|
||||
$secure = Config::inst()->get('cookie_secure');
|
||||
$domain = Config::inst()->get('Session', 'cookie_domain');
|
||||
$secure = Config::inst()->get('Session', 'cookie_secure');
|
||||
|
||||
if($domain) {
|
||||
setcookie(session_name(), '', null, $path, $domain, $secure, true);
|
||||
setcookie(session_name(), '', null, $path, $domain, $secure, true);
|
||||
}
|
||||
else {
|
||||
setcookie(session_name(), '', null, $path, null, $secure, true);
|
||||
else {
|
||||
setcookie(session_name(), '', null, $path, null, $secure, true);
|
||||
}
|
||||
|
||||
unset($_COOKIE[session_name()]);
|
||||
}
|
||||
|
||||
session_destroy();
|
||||
|
||||
// Clean up the superglobal - session_destroy does not do it.
|
||||
// http://nz1.php.net/manual/en/function.session-destroy.php
|
||||
unset($_SESSION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,8 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
public function logOut() {
|
||||
Session::clear("loggedInAs");
|
||||
if(Member::config()->login_marker_cookie) Cookie::set(Member::config()->login_marker_cookie, null, 0);
|
||||
self::session_regenerate_id();
|
||||
|
||||
Session::destroy();
|
||||
|
||||
$this->extend('memberLoggedOut');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user