mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-04 15:17:28 +02:00
Implement method 'destroySession' in class 'Auth'
This commit is contained in:
14
src/Auth.php
14
src/Auth.php
@@ -337,6 +337,20 @@ final class Auth extends UserManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys all session data
|
||||
*
|
||||
* @throws AuthError if an internal problem occurred (do *not* catch)
|
||||
*/
|
||||
public function destroySession() {
|
||||
// remove all session variables without exception
|
||||
$_SESSION = [];
|
||||
// delete the session cookie
|
||||
$this->deleteSessionCookie();
|
||||
// let PHP destroy the session
|
||||
\session_destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new directive keeping the user logged in ("remember me")
|
||||
*
|
||||
|
Reference in New Issue
Block a user