mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-05 07:37:25 +02:00
Compose 'logout' using new 'logOutButKeepSession' and 'destroySession'
This commit is contained in:
21
src/Auth.php
21
src/Auth.php
@@ -488,25 +488,8 @@ final class Auth extends UserManager {
|
|||||||
* @throws AuthError if an internal problem occurred (do *not* catch)
|
* @throws AuthError if an internal problem occurred (do *not* catch)
|
||||||
*/
|
*/
|
||||||
public function logout() {
|
public function logout() {
|
||||||
// if the user has been signed in
|
$this->logOutButKeepSession();
|
||||||
if ($this->isLoggedIn()) {
|
$this->destroySession();
|
||||||
// get the user's ID
|
|
||||||
$userId = $this->getUserId();
|
|
||||||
// if a user ID was set
|
|
||||||
if (isset($userId)) {
|
|
||||||
// delete any existing remember directives
|
|
||||||
$this->deleteRememberDirective($userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// unset the session variables
|
|
||||||
$_SESSION = array();
|
|
||||||
|
|
||||||
// delete the cookie
|
|
||||||
$this->deleteSessionCookie();
|
|
||||||
|
|
||||||
// destroy the session
|
|
||||||
session_destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user