feat(auth): add login/logout, user identity, and soft auth gate
- api/logout.php: destroys session + clears cookie, redirects to / - api/guest-session.php: sets guest flag, lets users explore without account - layout.php: removes hard PHP redirect; authenticated users see email + "Logg ut" in topbar; guests see guest banner (sticky, dismissible) and auth gate modal (dismissible via localStorage) instead of redirect - layout_footer.php: injects auth gate modal + JS for banner/modal dismiss - layout_dashboard.php: adds username + "Logg ut" to dash-topbar - index.php: adds "Utforsk uten konto" link under primary login CTA - tools.css: .guest-banner, .auth-gate-*, .topbar-user, .dash-topbar__user Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||||
dbnToolsStartSession();
|
||||
$_SESSION['dbn_tools_guest_ok'] = true;
|
||||
$raw = trim((string)($_GET['return'] ?? '/dashboard.php'));
|
||||
$return = (str_starts_with($raw, '/') && !str_starts_with($raw, '//') && !preg_match('/[\r\n]/', $raw))
|
||||
? $raw
|
||||
: '/dashboard.php';
|
||||
header('Location: ' . $return);
|
||||
exit;
|
||||
Reference in New Issue
Block a user