mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-14 00:07:01 +08:00
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:
@@ -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 />
|
||||
|
||||
Reference in New Issue
Block a user