1
0
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:
Marco
2017-09-18 16:07:05 +02:00
parent 1a195adf39
commit 82a24fbbca

View File

@@ -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")
*