1
0
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:
Marco
2017-09-18 16:08:32 +02:00
parent 82a24fbbca
commit 404739634d

View File

@@ -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();
} }
/** /**