validate password in the frontend too (#2017)

This commit is contained in:
Athou
2026-01-15 09:44:57 +01:00
parent eb573fdc8b
commit 5a95b95801
36 changed files with 223 additions and 125 deletions

View File

@@ -228,6 +228,7 @@ export interface ServerInfo {
treeReloadInterval: number
forceRefreshCooldownDuration: number
initialSetupRequired: boolean
minimumPasswordLength: number
}
export interface SharingSettings {

View File

@@ -26,8 +26,13 @@ export function ProfileSettings() {
const form = useForm<FormData>({
validate: {
newPassword: value =>
value && serverInfos && value.length < serverInfos.minimumPasswordLength
? _(msg`Password must be at least ${serverInfos.minimumPasswordLength} characters`)
: null,
newPasswordConfirmation: (value, values) => (value !== values.newPassword ? _(msg`Passwords do not match`) : null),
},
validateInputOnChange: true,
})
const { setValues } = form

View File

@@ -771,6 +771,13 @@ msgstr "الفئة الأصل"
msgid "Password"
msgstr "كلمة المرور"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "استعادة كلمة المرور"
@@ -1056,10 +1063,6 @@ msgstr "إلغاء النجم"
msgid "Unsubscribe"
msgstr "إلغاء الاشتراك"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "اسم المستخدم"

View File

@@ -771,6 +771,13 @@ msgstr "Categoria pare"
msgid "Password"
msgstr "Contrasenya"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Recuperació de contrasenya"
@@ -1056,10 +1063,6 @@ msgstr "Desestrellar"
msgid "Unsubscribe"
msgstr "Donar-se de baixa"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nom d'usuari"

View File

@@ -771,6 +771,13 @@ msgstr "Rodičovská kategorie"
msgid "Password"
msgstr "Heslo"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Obnovení hesla"
@@ -1056,10 +1063,6 @@ msgstr "Odstranit hvězdu"
msgid "Unsubscribe"
msgstr "Odhlásit odběr"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Uživatelské jméno"

View File

@@ -771,6 +771,13 @@ msgstr "Categori Rhiant"
msgid "Password"
msgstr "cyfrinair"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Adfer Cyfrinair"
@@ -1056,10 +1063,6 @@ msgstr "dad-seren"
msgid "Unsubscribe"
msgstr "Dad-danysgrifio"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Enw defnyddiwr"

View File

@@ -771,6 +771,13 @@ msgstr "Forældrekategori"
msgid "Password"
msgstr "Adgangskode"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Gendannelse af adgangskode"
@@ -1056,10 +1063,6 @@ msgstr ""
msgid "Unsubscribe"
msgstr "Afmeld"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Brugernavn"

View File

@@ -771,6 +771,13 @@ msgstr "Übergeordnete Kategorie"
msgid "Password"
msgstr "Passwort"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Passwortwiederherstellung"
@@ -1056,10 +1063,6 @@ msgstr "Stern entfernen"
msgid "Unsubscribe"
msgstr "Abbestellen"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Benutzername"

View File

@@ -771,6 +771,13 @@ msgstr "Parent Category"
msgid "Password"
msgstr "Password"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr "Password must be at least {0} characters"
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Password Recovery"
@@ -1056,10 +1063,6 @@ msgstr "Unstar"
msgid "Unsubscribe"
msgstr "Unsubscribe"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr "User created."
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "User name"

View File

@@ -772,6 +772,13 @@ msgstr "Categoría principal"
msgid "Password"
msgstr "Contraseña"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Recuperación de contraseña"
@@ -1057,10 +1064,6 @@ msgstr "Desmarcar"
msgid "Unsubscribe"
msgstr "Cancelar suscripción"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nombre de usuario"

View File

@@ -771,6 +771,13 @@ msgstr "دسته والد"
msgid "Password"
msgstr "رمز عبور"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "بازیابی رمز عبور"
@@ -1056,10 +1063,6 @@ msgstr ""
msgid "Unsubscribe"
msgstr "لغو اشتراک"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "نام کاربری"

View File

@@ -771,6 +771,13 @@ msgstr "Pääluokka"
msgid "Password"
msgstr "Salasana"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Salasanan palautus"
@@ -1056,10 +1063,6 @@ msgstr "Poista tähti"
msgid "Unsubscribe"
msgstr "Peruuta tilaus"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Käyttäjänimi"

View File

@@ -771,6 +771,13 @@ msgstr "Catégorie parente"
msgid "Password"
msgstr "Mot de passe"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Récupération de mot de passe"
@@ -1056,10 +1063,6 @@ msgstr "Retirer des favoris"
msgid "Unsubscribe"
msgstr "Se désabonner"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr "Compte créé."
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nom"

View File

@@ -772,6 +772,13 @@ msgstr "Categoría superior"
msgid "Password"
msgstr "Contrasinal"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Recuperación do contrasinal"
@@ -1057,10 +1064,6 @@ msgstr "Retirar estrela"
msgid "Unsubscribe"
msgstr "Cancelar a subscrición"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Identificador"

View File

@@ -771,6 +771,13 @@ msgstr "Szülő kategória"
msgid "Password"
msgstr "Jelszó"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Jelszó helyreállítás"
@@ -1056,10 +1063,6 @@ msgstr ""
msgid "Unsubscribe"
msgstr "Leiratkozás"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Felhasználónév"

View File

@@ -771,6 +771,13 @@ msgstr "Kategori Induk"
msgid "Password"
msgstr "Kata Sandi"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Pemulihan Kata Sandi"
@@ -1056,10 +1063,6 @@ msgstr "Hapus bintang"
msgid "Unsubscribe"
msgstr "Berhenti berlangganan"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nama pengguna"

View File

@@ -771,6 +771,13 @@ msgstr "Categoria padre"
msgid "Password"
msgstr ""
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Recupero password"
@@ -1056,10 +1063,6 @@ msgstr "Elimina le stelle"
msgid "Unsubscribe"
msgstr "Annulla iscrizione"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nome utente"

View File

@@ -771,6 +771,13 @@ msgstr "親カテゴリ"
msgid "Password"
msgstr "パスワード"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "パスワード回復"
@@ -1056,10 +1063,6 @@ msgstr "スターを外す"
msgid "Unsubscribe"
msgstr "退会"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "ユーザー名"

View File

@@ -771,6 +771,13 @@ msgstr "부모 카테고리"
msgid "Password"
msgstr "비밀번호"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "비밀번호 복구"
@@ -1056,10 +1063,6 @@ msgstr "별표 제거"
msgid "Unsubscribe"
msgstr "구독 취소"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "사용자 이름"

View File

@@ -771,6 +771,13 @@ msgstr "Kategori Induk"
msgid "Password"
msgstr "Kata Laluan"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Pemulihan Kata Laluan"
@@ -1056,10 +1063,6 @@ msgstr "Nyahbintang"
msgid "Unsubscribe"
msgstr "Nyahlanggan"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nama pengguna"

View File

@@ -771,6 +771,13 @@ msgstr "Overordnet kategori"
msgid "Password"
msgstr "Passord"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Passordgjenoppretting"
@@ -1056,10 +1063,6 @@ msgstr "Fjern stjerne"
msgid "Unsubscribe"
msgstr "Avslutt abonnementet"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Brukernavn"

View File

@@ -771,6 +771,13 @@ msgstr "Oudercategorie"
msgid "Password"
msgstr "Wachtwoord"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Wachtwoordherstel"
@@ -1056,10 +1063,6 @@ msgstr "Sterren uit"
msgid "Unsubscribe"
msgstr "Afmelden"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Gebruikersnaam"

View File

@@ -771,6 +771,13 @@ msgstr "Overordnet kategori"
msgid "Password"
msgstr "Passord"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Passordgjenoppretting"
@@ -1056,10 +1063,6 @@ msgstr "Fjern stjerne"
msgid "Unsubscribe"
msgstr "Avslutt abonnementet"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Brukernavn"

View File

@@ -771,6 +771,13 @@ msgstr "Kategoria nadrzędna"
msgid "Password"
msgstr "Hasło"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Odzyskiwanie hasła"
@@ -1056,10 +1063,6 @@ msgstr ""
msgid "Unsubscribe"
msgstr "Anuluj subskrypcję"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nazwa użytkownika"

View File

@@ -771,6 +771,13 @@ msgstr "Categoria Pai"
msgid "Password"
msgstr "Senha"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Recuperação de Senha"
@@ -1056,10 +1063,6 @@ msgstr "Desestrelar"
msgid "Unsubscribe"
msgstr "Cancelar inscrição"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Nome de usuário"

View File

@@ -771,6 +771,13 @@ msgstr "Родительская категория"
msgid "Password"
msgstr "Пароль"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Восстановление пароля"
@@ -1056,10 +1063,6 @@ msgstr "Удалить из избранного"
msgid "Unsubscribe"
msgstr "Отписаться"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Имя пользователя"

View File

@@ -771,6 +771,13 @@ msgstr "Rodičovská kategória"
msgid "Password"
msgstr "Heslo"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Obnovenie hesla"
@@ -1056,10 +1063,6 @@ msgstr "Odobrať hviezdičku"
msgid "Unsubscribe"
msgstr "Zrušte odber"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Meno používateľa"

View File

@@ -771,6 +771,13 @@ msgstr "Föräldrakategori"
msgid "Password"
msgstr "Lösenord"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Lösenordsåterställning"
@@ -1056,10 +1063,6 @@ msgstr ""
msgid "Unsubscribe"
msgstr "Avregistrera"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Användarnamn"

View File

@@ -771,6 +771,13 @@ msgstr "Üst Kategori"
msgid "Password"
msgstr "Şifre"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "Parola Kurtarma"
@@ -1056,10 +1063,6 @@ msgstr "Yıldızı kaldır"
msgid "Unsubscribe"
msgstr "Aboneliği iptal et"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr ""
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "Kullanıcı adı"

View File

@@ -771,6 +771,13 @@ msgstr "父类别"
msgid "Password"
msgstr "密码"
#. placeholder {0}: serverInfos.minimumPasswordLength
#: src/components/settings/ProfileSettings.tsx
#: src/pages/auth/InitialSetupPage.tsx
#: src/pages/auth/RegistrationPage.tsx
msgid "Password must be at least {0} characters"
msgstr ""
#: src/pages/auth/PasswordRecoveryPage.tsx
msgid "Password Recovery"
msgstr "密码恢复"
@@ -1056,10 +1063,6 @@ msgstr "取消星标"
msgid "Unsubscribe"
msgstr "取消订阅"
#: src/pages/auth/InitialSetupPage.tsx
msgid "User created."
msgstr "用户已创建。"
#: src/components/settings/ProfileSettings.tsx
msgid "User name"
msgstr "用户名"

View File

@@ -6,12 +6,13 @@ import { useForm } from "@mantine/form"
import { useAsyncCallback } from "react-async-hook"
import { client, errorToStrings } from "@/app/client"
import { redirectToRootCategory } from "@/app/redirect/thunks"
import { useAppDispatch } from "@/app/store"
import { useAppDispatch, useAppSelector } from "@/app/store"
import type { InitialSetupRequest } from "@/app/types"
import { Alert } from "@/components/Alert"
import { PageTitle } from "@/pages/PageTitle"
export function InitialSetupPage() {
const serverInfos = useAppSelector(state => state.server.serverInfos)
const dispatch = useAppDispatch()
const { _ } = useLingui()
@@ -21,6 +22,13 @@ export function InitialSetupPage() {
password: "",
email: "",
},
validate: {
password: value =>
serverInfos && value.length < serverInfos.minimumPasswordLength
? _(msg`Password must be at least ${serverInfos.minimumPasswordLength} characters`)
: null,
},
validateInputOnChange: true,
})
const login = useAsyncCallback(client.user.login, {

View File

@@ -23,6 +23,13 @@ export function RegistrationPage() {
password: "",
email: "",
},
validate: {
password: value =>
serverInfos && value.length < serverInfos.minimumPasswordLength
? _(msg`Password must be at least ${serverInfos.minimumPasswordLength} characters`)
: null,
},
validateInputOnChange: true,
})
const login = useAsyncCallback(client.user.login, {

View File

@@ -49,4 +49,7 @@ public class ServerInfo implements Serializable {
@Schema(required = true)
private boolean initialSetupRequired;
@Schema(required = true)
private int minimumPasswordLength;
}

View File

@@ -61,6 +61,7 @@ public class ServerREST {
infos.setTreeReloadInterval(config.websocket().treeReloadInterval().toMillis());
infos.setForceRefreshCooldownDuration(config.feedRefresh().forceRefreshCooldownDuration().toMillis());
infos.setInitialSetupRequired(databaseStartupService.isInitialSetupRequired());
infos.setMinimumPasswordLength(config.users().minimumPasswordLength());
return infos;
}

View File

@@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test;
import com.commafeed.TestConstants;
import com.microsoft.playwright.BrowserContext;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.assertions.PlaywrightAssertions;
import com.microsoft.playwright.options.AriaRole;
@@ -48,17 +47,6 @@ class AuthentificationIT {
PlaywrightAssertions.assertThat(page).hasURL("http://localhost:8085/#/app/category/all");
}
@Test
void registerFailPasswordTooSimple() {
Page page = context.newPage();
page.navigate(getLoginPageUrl());
page.getByText("Sign up!").click();
PlaywrightTestUtils.register(page, "user", "user@domain.com", "p");
Locator alert = page.getByRole(AriaRole.ALERT);
PlaywrightAssertions.assertThat(alert).containsText("Password must be 4 or more characters in length.");
}
@Test
void registerSuccess() {
Page page = context.newPage();

View File

@@ -22,6 +22,7 @@ class ServerIT extends BaseIT {
Assertions.assertEquals(900000, serverInfos.getWebsocketPingInterval());
Assertions.assertEquals(30000, serverInfos.getTreeReloadInterval());
Assertions.assertEquals(60000, serverInfos.getForceRefreshCooldownDuration());
Assertions.assertEquals(4, serverInfos.getMinimumPasswordLength());
}
}