diff --git a/src/app/admin/settings/page.tsx b/src/app/admin/settings/page.tsx index 5dc076d..a7bbdc8 100644 --- a/src/app/admin/settings/page.tsx +++ b/src/app/admin/settings/page.tsx @@ -31,6 +31,7 @@ interface IndexerConfig { interface Settings { backendMode: 'plex' | 'audiobookshelf'; + hasLocalUsers: boolean; plex: { url: string; token: string; @@ -777,12 +778,12 @@ export default function AdminSettings() { break; case 'auth': - // Validate: In Audiobookshelf mode, at least one auth method must be enabled + // Validate: In Audiobookshelf mode, at least one auth method must be enabled OR local users must exist if (settings.backendMode === 'audiobookshelf') { - if (!settings.oidc.enabled && !settings.registration.enabled) { + if (!settings.oidc.enabled && !settings.registration.enabled && !settings.hasLocalUsers) { setMessage({ type: 'error', - text: 'At least one authentication method must be enabled (OIDC or Manual Registration). Otherwise, users will not be able to log in.', + text: 'At least one authentication method must be enabled (OIDC or Manual Registration) since no local users exist. Otherwise, you will be locked out of the system.', }); setSaving(false); return; @@ -2296,8 +2297,8 @@ export default function AdminSettings() { - {/* Warning: No auth methods enabled */} - {settings.backendMode === 'audiobookshelf' && !settings.oidc.enabled && !settings.registration.enabled && ( + {/* Warning: No auth methods enabled AND no local users exist */} + {settings.backendMode === 'audiobookshelf' && !settings.oidc.enabled && !settings.registration.enabled && !settings.hasLocalUsers && (
@@ -2305,11 +2306,30 @@ export default function AdminSettings() {

- No Authentication Methods Enabled + No Authentication Methods Available

- You must enable at least one authentication method (OIDC or Manual Registration). - If you save with both disabled, users will not be able to log in to the system. + You must enable at least one authentication method (OIDC or Manual Registration) since no local users exist. + Saving with both disabled will lock you out of the system. +

+
+
+
+ )} + + {/* Info: Registration disabled but local users can still log in */} + {settings.backendMode === 'audiobookshelf' && !settings.oidc.enabled && !settings.registration.enabled && settings.hasLocalUsers && ( +
+
+ + + +
+

+ Manual Registration Disabled +

+

+ New user registration is disabled. Existing local users can still log in with their credentials.

@@ -2501,10 +2521,12 @@ export default function AdminSettings() { return !validated.audiobookshelf; } } - // For Auth tab: disable if no auth methods are enabled in Audiobookshelf mode + // For Auth tab: disable if no auth methods are enabled AND no local users exist in Audiobookshelf mode if (activeTab === 'auth' && settings) { if (settings.backendMode === 'audiobookshelf') { - return !settings.oidc.enabled && !settings.registration.enabled; + // Allow disabling both if local users exist (they can still log in) + // Prevent disabling both if no local users exist (would lock out system) + return !settings.oidc.enabled && !settings.registration.enabled && !settings.hasLocalUsers; } return false; } diff --git a/src/app/admin/users/page.tsx b/src/app/admin/users/page.tsx index f49bfa0..086672a 100644 --- a/src/app/admin/users/page.tsx +++ b/src/app/admin/users/page.tsx @@ -19,6 +19,7 @@ interface User { plexEmail: string; role: 'user' | 'admin'; isSetupAdmin: boolean; + authProvider: string | null; avatarUrl: string | null; createdAt: string; updatedAt: string; @@ -247,7 +248,7 @@ function AdminUsersPageContent() { )} {/* Users Table */} -
+
@@ -287,8 +288,11 @@ function AdminUsersPageContent() {
{user.plexUsername}
-
- Plex ID: {user.plexId} +
+ ID: {user.plexId.length > 12 ? `${user.plexId.substring(0, 12)}...` : user.plexId}
@@ -332,6 +336,13 @@ function AdminUsersPageContent() { Protected + ) : user.authProvider === 'oidc' ? ( + + + + + OIDC Managed + ) : (