@@ -116,6 +116,17 @@ class Auth
}
+ /**
+ * @return void
+ */
+ public static function logout()
+ {
+ unset($_SESSION[static::SESSION_IDENTIFIER]);
+
+ session_destroy();
+ }
/**
* Check if current user has a certain role, but User::ROLE_ADMIN will have access to all
*
@@ -1,5 +0,0 @@
-<?php
-require_once 'include/php/default.inc.php';
-
-session_destroy();
-redirect('/');
@@ -7,7 +7,11 @@ Router::addGet('/', 'include/php/pages/start.php');
* Auth
*/
Router::addMixed('/login', 'include/php/pages/login.php');
-Router::addGet('/logout', 'include/php/pages/logout.php');
+Router::addGet('/logout', function(){
+ Auth::logout();
+ redirect('/');
+ return;
+});
* Private area