Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
feat: merge oidc users with existing users toggle (#860)
Kyle Mendellc97af0aca0ab
diff --git a/backend/go.sum b/backend/go.sumindex 1eb32e3ec..b42572dea 100644--- a/backend/go.sum+++ b/backend/go.sum@@ -134,8 +134,6 @@ github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKgithub.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=github.com/docker/buildx v0.29.1 h1:58hxM5Z4mnNje3G5NKfULT9xCr8ooM8XFtlfUK9bKaA=github.com/docker/buildx v0.29.1/go.mod h1:J4EFv6oxlPiV1MjO0VyJx2u5tLM7ImDEl9zyB8d4wPI=-github.com/docker/cli v28.5.1+incompatible h1:ESutzBALAD6qyCLqbQSEf1a/U8Ybms5agw59yGVc+yY=-github.com/docker/cli v28.5.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=github.com/docker/cli v28.5.2+incompatible h1:XmG99IHcBmIAoC1PPg9eLBZPlTrNUAijsHLm8PjhBlg=github.com/docker/cli v28.5.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=github.com/docker/cli-docs-tool v0.10.0 h1:bOD6mKynPQgojQi3s2jgcUWGp/Ebqy1SeCr9VfKQLLU=@@ -145,8 +143,6 @@ github.com/docker/compose/v2 v2.40.3/go.mod h1:iNY1tvoHTyN3C3QHCuWAgj3OjR2T6mGkkgithub.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=-github.com/docker/docker v28.5.1+incompatible h1:Bm8DchhSD2J6PsFzxC35TZo4TLGR2PdW/E69rU45NhM=-github.com/docker/docker v28.5.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM=github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8=@@ -200,8 +196,6 @@ github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyecgithub.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc=github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ=-github.com/go-co-op/gocron/v2 v2.17.0 h1:e/oj6fcAM8vOOKZxv2Cgfmjo+s8AXC46po5ZPtaSea4=-github.com/go-co-op/gocron/v2 v2.17.0/go.mod h1:Zii6he+Zfgy5W9B+JKk/KwejFOW0kZTFvHtwIpR4aBI=github.com/go-co-op/gocron/v2 v2.18.0 h1:DS3Uhru66q1jy/5f9V0itmi3cLXcn2b7N+duGfgT7gU=github.com/go-co-op/gocron/v2 v2.18.0/go.mod h1:Zii6he+Zfgy5W9B+JKk/KwejFOW0kZTFvHtwIpR4aBI=github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs=diff --git a/backend/internal/dto/oidc_dto.go b/backend/internal/dto/oidc_dto.goindex 2a4e45a61..aad20aae5 100644--- a/backend/internal/dto/oidc_dto.go+++ b/backend/internal/dto/oidc_dto.go@@ -4,6 +4,7 @@ type OidcUserInfo struct {Subject string `json:"sub"`Name string `json:"name,omitempty"`Email string `json:"email,omitempty"`+ EmailVerified bool `json:"email_verified,omitempty"`PreferredUsername string `json:"preferred_username,omitempty"`GivenName string `json:"given_name,omitempty"`FamilyName string `json:"family_name,omitempty"`@@ -37,6 +38,7 @@ type OidcTokenResponse struct {type OidcStatusInfo struct {EnvForced bool `json:"envForced"`EnvConfigured bool `json:"envConfigured"`+ MergeAccounts bool `json:"mergeAccounts"`}type OidcAuthUrlRequest struct {diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.goindex 9b013fb30..dbc2c9c38 100644--- a/backend/internal/models/settings.go+++ b/backend/internal/models/settings.go@@ -70,11 +70,12 @@ type Settings struct {DockerHost SettingVariable `key:"dockerHost,public,envOverride" meta:"label=Docker Host;type=text;keywords=docker,host,daemon,socket,unix,remote;category=docker;description=URI for Docker daemon"`// Security category- AuthLocalEnabled SettingVariable `key:"authLocalEnabled,public" meta:"label=Local Authentication;type=boolean;keywords=local,auth,authentication,username,password,login,credentials;category=security;description=Enable local username/password authentication" catmeta:"id=security;title=Security;icon=shield;url=/settings/security;description=Manage authentication and security settings"`- AuthOidcEnabled SettingVariable `key:"authOidcEnabled,public" meta:"label=OIDC Authentication;type=boolean;keywords=oidc,openid,connect,sso,oauth,external,provider,federation;category=security;description=Enable OpenID Connect (OIDC) authentication"`- AuthSessionTimeout SettingVariable `key:"authSessionTimeout" meta:"label=Session Timeout;type=number;keywords=session,timeout,expire,duration,lifetime,minutes,logout;category=security;description=How long user sessions remain active"`- AuthPasswordPolicy SettingVariable `key:"authPasswordPolicy" meta:"label=Password Policy;type=select;keywords=password,policy,strength,complexity,requirements,security,rules;category=security;description=Set password strength requirements"`- AuthOidcConfig SettingVariable `key:"authOidcConfig,sensitive" meta:"label=OIDC Config;type=text;keywords=oidc,config,client,id,issuer,secret,oauth;category=security;description=OIDC provider configuration"`+ AuthLocalEnabled SettingVariable `key:"authLocalEnabled,public" meta:"label=Local Authentication;type=boolean;keywords=local,auth,authentication,username,password,login,credentials;category=security;description=Enable local username/password authentication" catmeta:"id=security;title=Security;icon=shield;url=/settings/security;description=Manage authentication and security settings"`+ AuthOidcEnabled SettingVariable `key:"authOidcEnabled,public" meta:"label=OIDC Authentication;type=boolean;keywords=oidc,openid,connect,sso,oauth,external,provider,federation;category=security;description=Enable OpenID Connect (OIDC) authentication"`+ AuthOidcMergeAccounts SettingVariable `key:"authOidcMergeAccounts,public" meta:"label=OIDC Account Merging;type=boolean;keywords=oidc,merge,link,accounts,email,match,existing,users,combine;category=security;description=Allow OIDC logins to merge with existing accounts by email"`+ AuthSessionTimeout SettingVariable `key:"authSessionTimeout" meta:"label=Session Timeout;type=number;keywords=session,timeout,expire,duration,lifetime,minutes,logout;category=security;description=How long user sessions remain active"`+ AuthPasswordPolicy SettingVariable `key:"authPasswordPolicy" meta:"label=Password Policy;type=select;keywords=password,policy,strength,complexity,requirements,security,rules;category=security;description=Set password strength requirements"`+ AuthOidcConfig SettingVariable `key:"authOidcConfig,sensitive" meta:"label=OIDC Config;type=text;keywords=oidc,config,client,id,issuer,secret,oauth;category=security;description=OIDC provider configuration"`// Navigation categoryMobileNavigationMode SettingVariable `key:"mobileNavigationMode,public,local" meta:"label=Mobile Navigation Mode;type=select;keywords=mode,style,type,floating,docked,position,layout,design,appearance,bottom;category=navigation;description=Choose between floating or docked navigation on mobile" catmeta:"id=navigation;title=Navigation;icon=navigation;url=/settings/navigation;description=Customize navigation and interface behavior"`diff --git a/backend/internal/services/auth_service.go b/backend/internal/services/auth_service.goindex da7e08235..012f15cb0 100644--- a/backend/internal/services/auth_service.go+++ b/backend/internal/services/auth_service.go@@ -95,8 +95,22 @@ func (s *AuthService) getAuthSettings(ctx context.Context) (*AuthSettings, error}func (s *AuthService) GetOidcConfigurationStatus(ctx context.Context) (*dto.OidcStatusInfo, error) {+ mergeAccounts := false+ if s.settingsService != nil {+ func() {+ defer func() {+ // In tests, a zero-valued SettingsService may panic; treat as merge disabled+ _ = recover()+ }()+ if settings, err := s.settingsService.GetSettings(ctx); err == nil {+ mergeAccounts = settings.AuthOidcMergeAccounts.IsTrue()+ }+ }()+ }+status := &dto.OidcStatusInfo{- EnvForced: s.config.OidcEnabled,+ EnvForced: s.config.OidcEnabled,+ MergeAccounts: mergeAccounts,}if s.config.OidcEnabled {status.EnvConfigured = s.config.OidcClientID != "" && s.config.OidcIssuerURL != ""@@ -240,6 +254,29 @@ func (s *AuthService) findOrCreateOidcUser(ctx context.Context, userInfo dto.Oid}if user == nil {+ // Check if merge accounts is enabled in settings+ settings, settingsErr := s.settingsService.GetSettings(ctx)+ mergeEnabled := settingsErr == nil && settings.AuthOidcMergeAccounts.IsTrue()++ // If merge accounts is enabled, try to find existing user by email+ if mergeEnabled && userInfo.Email != "" {+ // Require email verification from OIDC provider before merging+ if !userInfo.EmailVerified {+ return nil, false, errors.New("email not verified by OIDC provider; cannot merge accounts")+ }++ existingUser, emailErr := s.userService.GetUserByEmail(ctx, userInfo.Email)+ if emailErr == nil && existingUser != nil {+ // Found existing user with matching email - merge the accounts+ slog.Info("Merging OIDC account with existing user", "email", userInfo.Email, "subject", userInfo.Subject)+ if mergeErr := s.mergeOidcWithExistingUser(ctx, existingUser, userInfo, tokenResp); mergeErr != nil {+ return nil, false, mergeErr+ }+ return existingUser, false, nil+ }+ }++ // No existing user found, create new OIDC usercreated, err := s.createOidcUser(ctx, userInfo, tokenResp)if err != nil {return nil, false, err@@ -324,6 +361,33 @@ func (s *AuthService) updateOidcUser(ctx context.Context, user *models.User, usereturn err}+func (s *AuthService) mergeOidcWithExistingUser(ctx context.Context, user *models.User, userInfo dto.OidcUserInfo, tokenResp *dto.OidcTokenResponse) error {+ // Perform the merge atomically to avoid races when multiple OIDC subjects share the same email+ _, err := s.userService.AttachOidcSubjectTransactional(ctx, user.ID, userInfo.Subject, func(u *models.User) {+ // Update display name if not set+ if userInfo.Name != "" && u.DisplayName == nil {+ u.DisplayName = &userInfo.Name+ }++ // Update admin role based on OIDC claims+ wantAdmin := s.isAdminFromOidc(ctx, userInfo, tokenResp)+ hasAdmin := hasRole(u.Roles, "admin")+ switch {+ case wantAdmin && !hasAdmin:+ u.Roles = addRole(u.Roles, "admin")+ case !wantAdmin && hasAdmin:+ u.Roles = removeRole(u.Roles, "admin")+ }++ // Persist OIDC tokens+ s.persistOidcTokens(u, tokenResp)++ now := time.Now()+ u.LastLogin = &now+ })+ return err+}+func hasRole(roles models.StringSlice, role string) bool {for _, r := range roles {if strings.EqualFold(r, role) {diff --git a/backend/internal/services/auth_service_test.go b/backend/internal/services/auth_service_test.goindex 32a5ea4aa..ee30bbd4b 100644--- a/backend/internal/services/auth_service_test.go+++ b/backend/internal/services/auth_service_test.go@@ -195,6 +195,10 @@ func TestGetOidcConfigurationStatus(t *testing.T) {// Disableds := newTestAuthService("")s.config = &config.Config{}+ // Set a non-nil settingsService to prevent nil pointer dereference+ // GetSettings will fail gracefully and mergeAccounts will default to false+ s.settingsService = &SettingsService{}+status, err := s.GetOidcConfigurationStatus(context.Background())if err != nil {t.Fatalf("GetOidcConfigurationStatus error: %v", err)@@ -202,6 +206,10 @@ func TestGetOidcConfigurationStatus(t *testing.T) {if status.EnvForced || status.EnvConfigured {t.Errorf("expected disabled, got forced=%v configured=%v", status.EnvForced, status.EnvConfigured)}+ // MergeAccounts will be false since GetSettings will fail+ if status.MergeAccounts {+ t.Errorf("expected mergeAccounts=false, got true")+ }// Enabled but missing fieldss.config.OidcEnabled = truediff --git a/backend/internal/services/oidc_service.go b/backend/internal/services/oidc_service.goindex 7f6347d44..cd34a8485 100644--- a/backend/internal/services/oidc_service.go+++ b/backend/internal/services/oidc_service.go@@ -326,6 +326,7 @@ func (s *OidcService) HandleCallback(ctx context.Context, code, state, storedStaSubject: subject,Name: utils.GetStringClaim(claims, "name"),Email: utils.GetStringClaim(claims, "email"),+ EmailVerified: utils.GetBoolClaim(claims, "email_verified"),PreferredUsername: utils.GetStringClaim(claims, "preferred_username"),GivenName: utils.GetStringClaim(claims, "given_name"),FamilyName: utils.GetStringClaim(claims, "family_name"),diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.goindex 0e1809e2a..e48be610b 100644--- a/backend/internal/services/settings_service.go+++ b/backend/internal/services/settings_service.go@@ -89,6 +89,7 @@ func (s *SettingsService) getDefaultSettings() *models.Settings {DockerHost: models.SettingVariable{Value: "unix:///var/run/docker.sock"},AuthLocalEnabled: models.SettingVariable{Value: "true"},AuthOidcEnabled: models.SettingVariable{Value: "false"},+ AuthOidcMergeAccounts: models.SettingVariable{Value: "false"},AuthSessionTimeout: models.SettingVariable{Value: "1440"},AuthPasswordPolicy: models.SettingVariable{Value: "strong"},AuthOidcConfig: models.SettingVariable{Value: "{}"},diff --git a/backend/internal/services/user_service.go b/backend/internal/services/user_service.goindex 5d855095b..8ddae946f 100644--- a/backend/internal/services/user_service.go+++ b/backend/internal/services/user_service.go@@ -12,6 +12,7 @@ import ("golang.org/x/crypto/argon2""golang.org/x/crypto/bcrypt""gorm.io/gorm"+ "gorm.io/gorm/clause""crypto/subtle"@@ -190,6 +191,17 @@ func (s *UserService) GetUserByOidcSubjectId(ctx context.Context, subjectId strireturn &user, nil}+func (s *UserService) GetUserByEmail(ctx context.Context, email string) (*models.User, error) {+ var user models.User+ if err := s.db.WithContext(ctx).Where("email = ?", email).First(&user).Error; err != nil {+ if errors.Is(err, gorm.ErrRecordNotFound) {+ return nil, ErrUserNotFound+ }+ return nil, fmt.Errorf("failed to get user by email: %w", err)+ }+ return &user, nil+}+func (s *UserService) UpdateUser(ctx context.Context, user *models.User) (*models.User, error) {if err := s.db.WithContext(ctx).Save(user).Error; err != nil {return nil, fmt.Errorf("failed to update user: %w", err)@@ -197,6 +209,52 @@ func (s *UserService) UpdateUser(ctx context.Context, user *models.User) (*modelreturn user, nil}+// AttachOidcSubjectTransactional safely links an OIDC subject to the given user inside a DB transaction.+// It uses a row lock (FOR UPDATE) to prevent concurrent merges from racing and validates that the+// user isn't already linked to a different subject. The provided updateFn can mutate the user (e.g.,+// roles, display name, tokens, last login) before persisting.+func (s *UserService) AttachOidcSubjectTransactional(ctx context.Context, userID string, subject string, updateFn func(u *models.User)) (*models.User, error) {+ var out *models.User+ err := s.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {+ var u models.User+ if err := tx.+ Clauses(clause.Locking{Strength: "UPDATE"}).+ Where("id = ?", userID).+ First(&u).Error; err != nil {+ if errors.Is(err, gorm.ErrRecordNotFound) {+ return ErrUserNotFound+ }+ return fmt.Errorf("failed to load user for OIDC merge: %w", err)+ }++ // If already linked to a different subject, abort+ if u.OidcSubjectId != nil && *u.OidcSubjectId != "" && *u.OidcSubjectId != subject {+ return fmt.Errorf("user already linked to another OIDC subject")+ }++ // Link subject+ u.OidcSubjectId = &subject++ if updateFn != nil {+ updateFn(&u)+ }++ if err := tx.Save(&u).Error; err != nil {+ // Bubble up uniqueness violations with a clearer message+ if strings.Contains(strings.ToLower(err.Error()), "unique") || strings.Contains(strings.ToLower(err.Error()), "duplicate key") {+ return fmt.Errorf("oidc subject is already linked to another user: %w", err)+ }+ return fmt.Errorf("failed to persist OIDC merge: %w", err)+ }+ out = &u+ return nil+ })+ if err != nil {+ return nil, err+ }+ return out, nil+}+func (s *UserService) CountUsers() (int64, error) {var count int64if err := s.db.Model(&models.User{}).Count(&count).Error; err != nil {diff --git a/backend/resources/migrations/postgres/022_unique_oidc_subject_index.down.sql b/backend/resources/migrations/postgres/022_unique_oidc_subject_index.down.sqlnew file mode 100644index 000000000..ae265e30a--- /dev/null+++ b/backend/resources/migrations/postgres/022_unique_oidc_subject_index.down.sql@@ -0,0 +1 @@+DROP INDEX IF EXISTS idx_users_oidc_subject_id_unique;\ No newline at end of filediff --git a/backend/resources/migrations/postgres/022_unique_oidc_subject_index.up.sql b/backend/resources/migrations/postgres/022_unique_oidc_subject_index.up.sqlnew file mode 100644index 000000000..d8c941f38--- /dev/null+++ b/backend/resources/migrations/postgres/022_unique_oidc_subject_index.up.sql@@ -0,0 +1,4 @@+-- Ensure OIDC subject is unique across users while allowing NULL values+CREATE UNIQUE INDEX IF NOT EXISTS idx_users_oidc_subject_id_unique+ON users (oidc_subject_id)+WHERE oidc_subject_id IS NOT NULL;\ No newline at end of filediff --git a/backend/resources/migrations/sqlite/022_unique_oidc_subject_index.down.sql b/backend/resources/migrations/sqlite/022_unique_oidc_subject_index.down.sqlnew file mode 100644index 000000000..ae265e30a--- /dev/null+++ b/backend/resources/migrations/sqlite/022_unique_oidc_subject_index.down.sql@@ -0,0 +1 @@+DROP INDEX IF EXISTS idx_users_oidc_subject_id_unique;\ No newline at end of filediff --git a/backend/resources/migrations/sqlite/022_unique_oidc_subject_index.up.sql b/backend/resources/migrations/sqlite/022_unique_oidc_subject_index.up.sqlnew file mode 100644index 000000000..cbac702d8--- /dev/null+++ b/backend/resources/migrations/sqlite/022_unique_oidc_subject_index.up.sql@@ -0,0 +1,4 @@+-- Ensure OIDC subject is unique across users while allowing NULL values (SQLite >= 3.8 supports partial indexes)+CREATE UNIQUE INDEX IF NOT EXISTS idx_users_oidc_subject_id_unique+ON users(oidc_subject_id)+WHERE oidc_subject_id IS NOT NULL;\ No newline at end of filediff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex 11119ba12..4ea58af61 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -313,6 +313,8 @@"auth_oidc_init_failed": "Failed to initiate OIDC login. Please try again.","auth_oidc_redirecting_title": "Redirecting to Login…","auth_oidc_redirecting_description": "Please wait while we redirect you to your identity provider.",+ "auth_oidc_merge_accounts_title": "Account Linking Enabled",+ "auth_oidc_merge_accounts_description": "When you sign in with OIDC, your account will automatically link with any existing local account using the same email address. You can then use either login method.","_comment_dashboard": "=== DASHBOARD ===","dashboard_title": "Dashboard",@@ -822,6 +824,10 @@"security_oidc_auth_label": "OIDC Authentication","security_oidc_auth_description": "Use an external OIDC provider","security_oidc_auth_description_forced": "Use an external OIDC provider (forced by server)",+ "security_oidc_merge_accounts_label": "Link OIDC with Existing Accounts",+ "security_oidc_merge_accounts_description": "Allow OIDC logins to merge with existing local accounts by matching email addresses",+ "security_oidc_merge_accounts_alert_title": "Enable Account Linking?",+ "security_oidc_merge_accounts_alert_description": "When enabled, users signing in with OIDC will automatically link to any existing local account with the same email address. This allows users to log in with either method. Existing accounts will gain OIDC access without creating duplicates. Warning: Admin permissions will be overwritten based on OIDC claims during login - local admins may lose privileges if OIDC doesn't grant admin, or regular users may gain admin from OIDC claims.","security_server_forces_oidc_missing_env": "Server forces OIDC, but env vars missing. Configure or fix server env.","security_oidc_configured_forced_view": "OIDC configured & forced by server. View status.","security_manage_oidc_config": "Manage OIDC configuration",diff --git a/frontend/src/lib/types/settings.type.ts b/frontend/src/lib/types/settings.type.tsindex 7173c4a9b..3fd5460a0 100644--- a/frontend/src/lib/types/settings.type.ts+++ b/frontend/src/lib/types/settings.type.ts@@ -24,6 +24,7 @@ export type Settings = {authLocalEnabled: boolean;authOidcEnabled: boolean;+ authOidcMergeAccounts: boolean;authSessionTimeout: number;authPasswordPolicy: 'basic' | 'standard' | 'strong';authOidcConfig: string;@@ -66,4 +67,5 @@ export interface OidcConfig {export interface OidcStatusInfo {envForced: boolean;envConfigured: boolean;+ mergeAccounts: boolean;}diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelteindex f5029e4f5..b64fe8548 100644--- a/frontend/src/routes/settings/security/+page.svelte+++ b/frontend/src/routes/settings/security/+page.svelte@@ -1,5 +1,6 @@<script lang="ts">import * as Card from '$lib/components/ui/card';+ import * as AlertDialog from '$lib/components/ui/alert-dialog';import { z } from 'zod/v4';import { onMount } from 'svelte';import { createForm } from '$lib/utils/form.utils';@@ -27,6 +28,7 @@.object({authLocalEnabled: z.boolean(),authOidcEnabled: z.boolean(),+ authOidcMergeAccounts: z.boolean(),authSessionTimeout: z.number(m.security_session_timeout_required()).int(m.security_session_timeout_integer())@@ -47,6 +49,7 @@});let showOidcConfigDialog = $state(false);+ let showMergeAccountsAlert = $state(false);let oidcConfigForm = $state({clientId: '',@@ -63,6 +66,7 @@hasChangesChecker: () =>$formInputs.authLocalEnabled.value !== currentSettings.authLocalEnabled ||$formInputs.authOidcEnabled.value !== currentSettings.authOidcEnabled ||+ $formInputs.authOidcMergeAccounts.value !== currentSettings.authOidcMergeAccounts ||$formInputs.authSessionTimeout.value !== currentSettings.authSessionTimeout ||$formInputs.authPasswordPolicy.value !== currentSettings.authPasswordPolicy});@@ -95,6 +99,7 @@.updateSettings({authLocalEnabled: formData.authLocalEnabled,authOidcEnabled: formData.authOidcEnabled,+ authOidcMergeAccounts: formData.authOidcMergeAccounts,authSessionTimeout: formData.authSessionTimeout,authPasswordPolicy: formData.authPasswordPolicy,...(formData.authOidcEnabled && !data.oidcStatus.envForced && { authOidcConfig })@@ -110,6 +115,7 @@function resetForm() {$formInputs.authLocalEnabled.value = currentSettings.authLocalEnabled;$formInputs.authOidcEnabled.value = currentSettings.authOidcEnabled;+ $formInputs.authOidcMergeAccounts.value = currentSettings.authOidcMergeAccounts;$formInputs.authSessionTimeout.value = currentSettings.authSessionTimeout;$formInputs.authPasswordPolicy.value = currentSettings.authPasswordPolicy;}@@ -137,6 +143,24 @@$formInputs.authLocalEnabled.value = checked;}+ function handleMergeAccountsChange(checked: boolean) {+ if (checked && !currentSettings.authOidcMergeAccounts) {+ showMergeAccountsAlert = true;+ } else {+ $formInputs.authOidcMergeAccounts.value = checked;+ }+ }++ function confirmMergeAccounts() {+ $formInputs.authOidcMergeAccounts.value = true;+ showMergeAccountsAlert = false;+ }++ function cancelMergeAccounts() {+ $formInputs.authOidcMergeAccounts.value = false;+ showMergeAccountsAlert = false;+ }+function openOidcDialog() {if (currentSettings.authOidcConfig) {const cfg = JSON.parse(currentSettings.authOidcConfig);@@ -251,6 +275,18 @@</div>{/if}</div>++ {#if isOidcActive()}+ <div class="mt-3">+ <SwitchWithLabel+ id="oidcMergeAccountsSwitch"+ label={m.security_oidc_merge_accounts_label()}+ description={m.security_oidc_merge_accounts_description()}+ bind:checked={$formInputs.authOidcMergeAccounts.value}+ onCheckedChange={handleMergeAccountsChange}+ />+ </div>+ {/if}</div></Card.Content></Card.Root>@@ -342,5 +378,20 @@bind:oidcForm={oidcConfigForm}onSave={handleSaveOidcConfig}/>++ <AlertDialog.Root bind:open={showMergeAccountsAlert}>+ <AlertDialog.Content>+ <AlertDialog.Header>+ <AlertDialog.Title>{m.security_oidc_merge_accounts_alert_title()}</AlertDialog.Title>+ <AlertDialog.Description>+ {m.security_oidc_merge_accounts_alert_description()}+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <AlertDialog.Cancel onclick={cancelMergeAccounts}>{m.common_cancel()}</AlertDialog.Cancel>+ <AlertDialog.Action onclick={confirmMergeAccounts}>{m.common_confirm()}</AlertDialog.Action>+ </AlertDialog.Footer>+ </AlertDialog.Content>+ </AlertDialog.Root>{/snippet}</SettingsPageLayout>