Improve tracking UX, archive editing, branding, and proxy-safe auth flow
This commit is contained in:
+13
-5
@@ -27,16 +27,24 @@ final class App
|
||||
|
||||
$path = request_path();
|
||||
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
|
||||
$hasUsers = $this->users->hasAnyUsers();
|
||||
$isAuthenticated = $this->auth->check();
|
||||
|
||||
if (!$this->users->hasAnyUsers()) {
|
||||
if ($path !== '/setup') {
|
||||
if (!$hasUsers) {
|
||||
if ($path === '/login') {
|
||||
$path = '/setup';
|
||||
} elseif ($path !== '/setup') {
|
||||
redirect('/setup');
|
||||
}
|
||||
} elseif (!$this->auth->check() && $path !== '/login') {
|
||||
redirect('/login');
|
||||
} elseif (!$isAuthenticated) {
|
||||
if ($path === '/setup') {
|
||||
$path = '/login';
|
||||
} elseif ($path !== '/login') {
|
||||
redirect('/login');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->auth->check() && in_array($path, ['/login', '/setup'], true)) {
|
||||
if ($isAuthenticated && in_array($path, ['/login', '/setup'], true)) {
|
||||
redirect('/');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user