Feat: Enable admin password in admin mode (#540)

* WIP: save local changes before merging
* Enable admin password in admin mode #374
This commit is contained in:
Burt
2025-11-05 21:48:28 +08:00
committed by GitHub
parent 96ed2c6ea7
commit 8b853a963d
13 changed files with 421 additions and 91 deletions

View File

@@ -229,6 +229,10 @@ function App() {
return <LoginPage />
}
if (route === '/register') {
if (systemConfig?.admin_mode) {
window.history.pushState({}, '', '/login');
return <LoginPage />;
}
return <RegisterPage />
}
if (route === '/reset-password') {
@@ -286,10 +290,15 @@ function App() {
// Show landing page for root route
if (route === '/' || route === '') {
return <LandingPage />
return <LandingPage isAdminMode={systemConfig?.admin_mode} />;
}
// Show main app for authenticated users on other routes
// In admin mode, require authentication for any protected routes
if (systemConfig?.admin_mode && (!user || !token)) {
return <LoginPage />;
}
// Show main app for authenticated users on other routes (non-admin mode)
if (!systemConfig?.admin_mode && (!user || !token)) {
// Default to landing page when not authenticated and no specific route
return <LandingPage />