Create cookie-based login and authentication system

This commit is contained in:
Alex Cabal 2022-07-10 18:58:55 -05:00
parent 45221365b5
commit 0bc3dc3830
46 changed files with 528 additions and 195 deletions

View file

@ -39,4 +39,19 @@ class Template{
include(WEB_ROOT . '/404.php');
exit();
}
public static function RedirectToLogin(bool $redirectToDestination = true, string $destinationUrl = null): void{
if($redirectToDestination){
if($destinationUrl === null){
$destinationUrl = $_SERVER['SCRIPT_URL'];
}
header('Location: /sessions/new?redirect=' . urlencode($destinationUrl));
}
else{
header('Location: /sessions/new');
}
exit();
}
}