mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
beforeMemberLoggedIn/beforeMemberLoggedOut hooks
Required to save/restore parts of the session information, which Member nukes indiscriminately on logout. Specific use case is restoring linkages to temporary databases on Behat test runs.
This commit is contained in:
parent
763aa2fbf6
commit
15c7252af0
@ -364,6 +364,8 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
* @param bool $remember If set to TRUE, the member will be logged in automatically the next time.
|
||||
*/
|
||||
public function logIn($remember = false) {
|
||||
$this->extend('beforeMemberLoggedIn');
|
||||
|
||||
self::session_regenerate_id();
|
||||
|
||||
Session::set("loggedInAs", $this->ID);
|
||||
@ -469,6 +471,8 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
* Logs this member out.
|
||||
*/
|
||||
public function logOut() {
|
||||
$this->extend('beforeMemberLoggedOut');
|
||||
|
||||
Session::clear("loggedInAs");
|
||||
if(Member::config()->login_marker_cookie) Cookie::set(Member::config()->login_marker_cookie, null, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user