diff --git a/src/Auth.php b/src/Auth.php index 3a6a11a..b3066da 100644 --- a/src/Auth.php +++ b/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") *