Skip to content

Commit e1013f4

Browse files
committed
feat(auth): skip password requirement for default "admin" password
- Treat default "admin" password as unauthenticated access - Update password check logic in both auth API and login page to exclude "admin" from requiring authentication - Remove minLength constraint from password input field - Add clarifying comments about default password handling This change improves user experience by allowing immediate access when using the default password, while still requiring authentication for custom passwords.
1 parent a567587 commit e1013f4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/app/api/auth/check/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ export async function GET() {
77
const config = await configLoader.loadConfig();
88
const dashboardPassword = config.global?.server?.dashboardPassword;
99

10+
// Only require password if it's set and not the default "admin"
1011
return NextResponse.json({
11-
passwordRequired: !!dashboardPassword && dashboardPassword.length > 0,
12+
passwordRequired: !!dashboardPassword && dashboardPassword.length > 0 && dashboardPassword !== 'admin',
1213
});
1314
} catch (error) {
1415
console.error('Failed to check auth status:', error);

src/app/login/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ function LoginForm() {
2020
const { data: _session, status } = useSession();
2121
const { config } = useConfig();
2222

23-
// Check if password is configured
23+
// Check if a custom password is configured (not the default "admin")
2424
const isPasswordConfigured = config?.global?.server?.dashboardPassword &&
25-
config.global.server.dashboardPassword.trim().length > 0;
25+
config.global.server.dashboardPassword.trim().length > 0 &&
26+
config.global.server.dashboardPassword !== 'admin';
2627

2728
// Redirect if already authenticated
2829
useEffect(() => {
@@ -108,7 +109,6 @@ function LoginForm() {
108109
onChange={(e) => setPassword(e.target.value)}
109110
required
110111
autoFocus
111-
minLength={4}
112112
/>
113113
{password.length > 0 && password.length < 4 && !(password === 'admin' && !isPasswordConfigured) && (
114114
<p className="text-xs text-muted-foreground">

0 commit comments

Comments
 (0)