Update w/ logout() method

This commit is contained in:
billz
2025-03-22 03:11:47 -07:00
parent 401172eb36
commit 03fc2c42ad

View File

@@ -74,6 +74,20 @@ class HTTPAuth
return false;
}
/*
* Logs out the administrative user
*/
public function logout(): void
{
session_unset(); // unset all session variables
session_destroy(); // destroy the session
$redirectUrl = $_SERVER['REQUEST_URI'];
if (strpos($redirectUrl, '/login') === false) {
header('Location: /login?action=' . urlencode($redirectUrl));
exit();
}
}
/*
* Gets the current authentication config
* return array $config