diff --git a/frontend-modern/src/components/Settings/QuickSecuritySetup.tsx b/frontend-modern/src/components/Settings/QuickSecuritySetup.tsx index 7000dddc3..5842a3108 100644 --- a/frontend-modern/src/components/Settings/QuickSecuritySetup.tsx +++ b/frontend-modern/src/components/Settings/QuickSecuritySetup.tsx @@ -14,6 +14,10 @@ export const QuickSecuritySetup: Component = () => { const [copied, setCopied] = createSignal<'username' | 'password' | 'token' | null>(null); const [readyToRestart, setReadyToRestart] = createSignal(false); const [isRestarting, setIsRestarting] = createSignal(false); + const [useCustomPassword, setUseCustomPassword] = createSignal(false); + const [customUsername, setCustomUsername] = createSignal('admin'); + const [customPassword, setCustomPassword] = createSignal(''); + const [confirmPassword, setConfirmPassword] = createSignal(''); const generatePassword = (length: number = 16): string => { // Avoid special chars that could cause issues with URLs or shell commands @@ -72,13 +76,25 @@ export const QuickSecuritySetup: Component = () => { }; const setupSecurity = async () => { + // Validate custom password if using + if (useCustomPassword()) { + if (customPassword().length < 8) { + showError('Password must be at least 8 characters'); + return; + } + if (customPassword() !== confirmPassword()) { + showError('Passwords do not match'); + return; + } + } + setIsSettingUp(true); try { - // Generate credentials + // Generate or use custom credentials const newCredentials: SecurityCredentials = { - username: 'admin', - password: generatePassword(), + username: customUsername(), + password: useCustomPassword() ? customPassword() : generatePassword(), apiToken: generateToken() }; @@ -188,6 +204,83 @@ Important: +
+ A secure 16-character password will be generated for you +
+Important:
-Credentials will be shown only once. Save them immediately!
+{useCustomPassword() + ? 'Your password will be hashed before storage' + : 'Credentials will be shown only once. Save them immediately!'}