mirror of
https://github.com/standardebooks/web.git
synced 2025-07-18 12:26:39 -04:00
Create cookie-based login and authentication system
This commit is contained in:
parent
45221365b5
commit
0bc3dc3830
46 changed files with 528 additions and 195 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue