autofworward after login
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s

This commit is contained in:
Chris 2023-10-26 22:04:05 +02:00
parent 5dda6b958d
commit 339321a322
4 changed files with 20 additions and 3 deletions

View File

@ -82,7 +82,7 @@ function callHook($url)
if (!$dispatch->maySeeThisPage()) {
$componentName = 'err';
$action = 'notallowed';
$dispatch = new $componentName('error', $action, true);
$dispatch = new $componentName('err', $action, true);
} else
$dispatch = new $componentName($component, $action, true, $queryString);

View File

@ -11,7 +11,8 @@ class Err extends Page {
function notallowed()
{
return json_encode(['error'=>'not allowed']);
$this->set("loggedin",(isset($_SESSION['user']) && $_SESSION['user'] !== false));
$this->set('template', "notallowed.html");
}
}

View File

@ -0,0 +1,13 @@
<div class="alert alert-danger animate__animated animate__headShake" role="alert">
<h4 class="alert-heading">Not allowed</h4>
Zugriff nicht erlaubt
</div>
<div class="row justify-content-center align-items-center g-2">
<div class="col"></div>
<div class="col">
<?php if(!$loggedin) : ?>
<?= partial('../../pages/login/login.html'); ?>
<?php endif; ?></div>
<div class="col"></div>
</div>

View File

@ -78,6 +78,9 @@ class Login extends Page {
else
{
$u->login();
if($_SERVER['HTTP_HX_CURRENT_URL'] && !endsWith($_SERVER['HTTP_HX_CURRENT_URL'],'/login'))
$this->redirect($_SERVER['HTTP_HX_CURRENT_URL']);
else
$this->redirect('/');
}
}