Redirect authenticated users from landing page to dashboard
Logged-in users visiting tools.dobetternorge.no were landing on /#access (the unauthenticated marketing view). Now they go straight to /dashboard.php. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,11 +45,18 @@ if (isset($_GET['sso']) && !dbnToolsIsAuthenticated()) {
|
||||
}
|
||||
|
||||
$isAuthed = dbnToolsIsAuthenticated();
|
||||
$userEmail = $isAuthed ? (string)($_SESSION['dbn_tools_user_email'] ?? '') : '';
|
||||
|
||||
// Authenticated users have no reason to see the marketing landing page.
|
||||
if ($isAuthed) {
|
||||
header('Location: /dashboard.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$userEmail = '';
|
||||
$tools = dbnToolsLaunchedTools($uiLang);
|
||||
$workbench = dbnToolsWorkbenchMeta($uiLang);
|
||||
$langPath = '/';
|
||||
$toolsLogin = 'https://dobetternorge.no/tools-login.php?return=' . urlencode($returnPath);
|
||||
$toolsLogin = 'https://dobetternorge.no/tools-login.php?return=' . urlencode('/dashboard.php');
|
||||
$registerUrl = 'https://dobetternorge.no/register.php';
|
||||
|
||||
require_once __DIR__ . '/includes/tool-svgs.php';
|
||||
@@ -96,14 +103,7 @@ window.DBN_TOOLS_LANG = <?= json_encode($uiLang, JSON_UNESCAPED_UNICODE) ?>;
|
||||
<a href="<?= htmlspecialchars($langPath . '?lang=' . $langCode . '&return=' . urlencode($returnPath)) ?>" class="<?= $langCode === $uiLang ? 'is-active' : '' ?>"><?= htmlspecialchars(dbnToolsLanguageLabel($langCode)) ?></a>
|
||||
<?php endforeach; ?>
|
||||
</nav>
|
||||
<?php if ($isAuthed): ?>
|
||||
<div class="lt-auth-nav">
|
||||
<span class="lt-auth-nav__email"><?= htmlspecialchars($userEmail) ?></span>
|
||||
<a href="/dashboard.php" class="lt-nav__cta lt-nav__cta--enter"><?= htmlspecialchars(dbnToolsT('enter_workbench', $uiLang)) ?> →</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<a href="#access" class="lt-nav__cta"><?= htmlspecialchars(dbnToolsT('primary_access', $uiLang)) ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -130,15 +130,7 @@ window.DBN_TOOLS_LANG = <?= json_encode($uiLang, JSON_UNESCAPED_UNICODE) ?>;
|
||||
<span><?= htmlspecialchars(dbnToolsT('stat_passages_indexed', $uiLang)) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($isAuthed): ?>
|
||||
<div class="lt-hero__auth-cta">
|
||||
<span class="lt-hero__auth-check" aria-hidden="true">✓</span>
|
||||
<span class="lt-hero__auth-label"><?= htmlspecialchars(dbnToolsT('signed_in_as', $uiLang)) ?> <?= htmlspecialchars($userEmail) ?></span>
|
||||
<a href="/dashboard.php" class="lt-hero__enter-btn"><?= htmlspecialchars(dbnToolsT('enter_workbench', $uiLang)) ?> →</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<a href="#tools" class="lt-hero__cta-link"><?= htmlspecialchars(dbnToolsT('explore_tools', $uiLang)) ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -164,7 +156,7 @@ window.DBN_TOOLS_LANG = <?= json_encode($uiLang, JSON_UNESCAPED_UNICODE) ?>;
|
||||
<p class="lt-tools__sub"><?= htmlspecialchars(dbnToolsT('tools_section_sub', $uiLang)) ?></p>
|
||||
</div>
|
||||
<div class="lt-grid">
|
||||
<a class="lt-card lt-card--workbench" href="<?= $isAuthed ? '/workbench.php' : '#access' ?>" data-tool="workbench">
|
||||
<a class="lt-card lt-card--workbench" href="#access" data-tool="workbench">
|
||||
<div class="lt-card__art workbench-entry-art" aria-hidden="true">
|
||||
<span>WB</span>
|
||||
</div>
|
||||
@@ -172,7 +164,7 @@ window.DBN_TOOLS_LANG = <?= json_encode($uiLang, JSON_UNESCAPED_UNICODE) ?>;
|
||||
<p class="lt-card__badge"><?= htmlspecialchars($workbench['badge']) ?></p>
|
||||
<h3 class="lt-card__title"><?= htmlspecialchars($workbench['label']) ?></h3>
|
||||
<p class="lt-card__desc"><?= htmlspecialchars($workbench['description']) ?></p>
|
||||
<span class="lt-card__arrow"><?= htmlspecialchars($isAuthed ? dbnToolsT('enter_workbench', $uiLang) : dbnToolsT('primary_access', $uiLang)) ?> →</span>
|
||||
<span class="lt-card__arrow"><?= htmlspecialchars(dbnToolsT('primary_access', $uiLang)) ?> →</span>
|
||||
</div>
|
||||
</a>
|
||||
<?php foreach ($tools as $slug => $item): ?>
|
||||
@@ -189,11 +181,6 @@ window.DBN_TOOLS_LANG = <?= json_encode($uiLang, JSON_UNESCAPED_UNICODE) ?>;
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if ($isAuthed): ?>
|
||||
<div class="lt-tools__enter-strip">
|
||||
<a href="/dashboard.php" class="lt-access-btn"><?= htmlspecialchars(dbnToolsT('enter_workbench', $uiLang)) ?> →</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<section class="lt-trust">
|
||||
|
||||
Reference in New Issue
Block a user