diff --git a/commafeed-client/src/components/settings/ProfileSettings.tsx b/commafeed-client/src/components/settings/ProfileSettings.tsx index 7cfcf16c..05c7e4ba 100644 --- a/commafeed-client/src/components/settings/ProfileSettings.tsx +++ b/commafeed-client/src/components/settings/ProfileSettings.tsx @@ -1,4 +1,3 @@ -import { msg } from "@lingui/core/macro" import { useLingui } from "@lingui/react" import { Trans } from "@lingui/react/macro" import { Anchor, Box, Button, Checkbox, Divider, Group, Input, PasswordInput, Stack, Text, TextInput } from "@mantine/core" @@ -29,7 +28,7 @@ export function ProfileSettings() { const form = useForm({ validate: { newPassword: validationRules.password, - newPasswordConfirmation: (value, values) => (value !== values.newPassword ? _(msg`Passwords do not match`) : null), + newPasswordConfirmation: (value, values) => validationRules.passwordConfirmation(value, values.newPassword), }, validateInputOnChange: true, }) diff --git a/commafeed-client/src/hooks/useValidationRules.ts b/commafeed-client/src/hooks/useValidationRules.ts index a535320f..cea27ced 100644 --- a/commafeed-client/src/hooks/useValidationRules.ts +++ b/commafeed-client/src/hooks/useValidationRules.ts @@ -11,5 +11,7 @@ export function useValidationRules() { value && minimumPasswordLength && value.length < minimumPasswordLength ? _(msg`Password must be at least ${minimumPasswordLength} characters`) : null, + passwordConfirmation: (newPasswordConfirmation: string | undefined, newPassword: string | undefined) => + newPasswordConfirmation && newPasswordConfirmation !== newPassword ? _(msg`Passwords do not match`) : null, } } diff --git a/commafeed-client/src/locales/ar/messages.po b/commafeed-client/src/locales/ar/messages.po index b60859ed..e86d3e20 100644 --- a/commafeed-client/src/locales/ar/messages.po +++ b/commafeed-client/src/locales/ar/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "استعادة كلمة المرور" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "كلمات المرور غير متطابقة" diff --git a/commafeed-client/src/locales/ca/messages.po b/commafeed-client/src/locales/ca/messages.po index 2f3abe42..1d7380d0 100644 --- a/commafeed-client/src/locales/ca/messages.po +++ b/commafeed-client/src/locales/ca/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Recuperació de contrasenya" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Les contrasenyes no coincideixen" diff --git a/commafeed-client/src/locales/cs/messages.po b/commafeed-client/src/locales/cs/messages.po index 9c704047..29705ab9 100644 --- a/commafeed-client/src/locales/cs/messages.po +++ b/commafeed-client/src/locales/cs/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Obnovení hesla" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Hesla se neshodují" diff --git a/commafeed-client/src/locales/cy/messages.po b/commafeed-client/src/locales/cy/messages.po index 45232ad8..cb507372 100644 --- a/commafeed-client/src/locales/cy/messages.po +++ b/commafeed-client/src/locales/cy/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Adfer Cyfrinair" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Nid yw cyfrineiriau yn cyfateb" diff --git a/commafeed-client/src/locales/da/messages.po b/commafeed-client/src/locales/da/messages.po index 49083bad..74ba5afc 100644 --- a/commafeed-client/src/locales/da/messages.po +++ b/commafeed-client/src/locales/da/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Gendannelse af adgangskode" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Adgangskoder stemmer ikke overens" diff --git a/commafeed-client/src/locales/de/messages.po b/commafeed-client/src/locales/de/messages.po index 346bb2a2..d8ce7500 100644 --- a/commafeed-client/src/locales/de/messages.po +++ b/commafeed-client/src/locales/de/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Passwortwiederherstellung" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Passwörter stimmen nicht überein" diff --git a/commafeed-client/src/locales/en/messages.po b/commafeed-client/src/locales/en/messages.po index bb9501f0..bd031468 100644 --- a/commafeed-client/src/locales/en/messages.po +++ b/commafeed-client/src/locales/en/messages.po @@ -794,8 +794,7 @@ msgstr "Password must be at least {minimumPasswordLength} characters" msgid "Password Recovery" msgstr "Password Recovery" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Passwords do not match" diff --git a/commafeed-client/src/locales/es/messages.po b/commafeed-client/src/locales/es/messages.po index df8fda92..22febfeb 100644 --- a/commafeed-client/src/locales/es/messages.po +++ b/commafeed-client/src/locales/es/messages.po @@ -795,8 +795,7 @@ msgstr "" msgid "Password Recovery" msgstr "Recuperación de contraseña" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Las contraseñas no coinciden" diff --git a/commafeed-client/src/locales/fa/messages.po b/commafeed-client/src/locales/fa/messages.po index d9356170..c8abfd73 100644 --- a/commafeed-client/src/locales/fa/messages.po +++ b/commafeed-client/src/locales/fa/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "بازیابی رمز عبور" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "گذرواژه ها مطابقت ندارند" diff --git a/commafeed-client/src/locales/fi/messages.po b/commafeed-client/src/locales/fi/messages.po index 7badba9a..593c55d4 100644 --- a/commafeed-client/src/locales/fi/messages.po +++ b/commafeed-client/src/locales/fi/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Salasanan palautus" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Salasanat eivät täsmää" diff --git a/commafeed-client/src/locales/fr/messages.po b/commafeed-client/src/locales/fr/messages.po index c72f977d..0a4f5cc7 100644 --- a/commafeed-client/src/locales/fr/messages.po +++ b/commafeed-client/src/locales/fr/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Récupération de mot de passe" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Les mots de passe ne correspondent pas" diff --git a/commafeed-client/src/locales/gl/messages.po b/commafeed-client/src/locales/gl/messages.po index 29ec2c1f..62e9982b 100644 --- a/commafeed-client/src/locales/gl/messages.po +++ b/commafeed-client/src/locales/gl/messages.po @@ -795,8 +795,7 @@ msgstr "" msgid "Password Recovery" msgstr "Recuperación do contrasinal" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Os contrasinais non coinciden" diff --git a/commafeed-client/src/locales/hu/messages.po b/commafeed-client/src/locales/hu/messages.po index 214e28f2..3e5504cd 100644 --- a/commafeed-client/src/locales/hu/messages.po +++ b/commafeed-client/src/locales/hu/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Jelszó helyreállítás" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "A jelszavak nem egyeznek" diff --git a/commafeed-client/src/locales/id/messages.po b/commafeed-client/src/locales/id/messages.po index d4232421..08b95c99 100644 --- a/commafeed-client/src/locales/id/messages.po +++ b/commafeed-client/src/locales/id/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Pemulihan Kata Sandi" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Kata sandi tidak cocok" diff --git a/commafeed-client/src/locales/it/messages.po b/commafeed-client/src/locales/it/messages.po index 03d1fee7..9a842ffa 100644 --- a/commafeed-client/src/locales/it/messages.po +++ b/commafeed-client/src/locales/it/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Recupero password" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Le password non corrispondono" diff --git a/commafeed-client/src/locales/ja/messages.po b/commafeed-client/src/locales/ja/messages.po index 688ca278..82e5fe99 100644 --- a/commafeed-client/src/locales/ja/messages.po +++ b/commafeed-client/src/locales/ja/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "パスワード回復" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "パスワードが一致しません" diff --git a/commafeed-client/src/locales/ko/messages.po b/commafeed-client/src/locales/ko/messages.po index ed421d10..d254362a 100644 --- a/commafeed-client/src/locales/ko/messages.po +++ b/commafeed-client/src/locales/ko/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "비밀번호 복구" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "비밀번호가 일치하지 않습니다" diff --git a/commafeed-client/src/locales/ms/messages.po b/commafeed-client/src/locales/ms/messages.po index bf73d4e4..711c1a9d 100644 --- a/commafeed-client/src/locales/ms/messages.po +++ b/commafeed-client/src/locales/ms/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Pemulihan Kata Laluan" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Kata laluan tidak sepadan" diff --git a/commafeed-client/src/locales/nb/messages.po b/commafeed-client/src/locales/nb/messages.po index 60b25ad1..ec8a8efb 100644 --- a/commafeed-client/src/locales/nb/messages.po +++ b/commafeed-client/src/locales/nb/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Passordgjenoppretting" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Passordene samsvarer ikke" diff --git a/commafeed-client/src/locales/nl/messages.po b/commafeed-client/src/locales/nl/messages.po index 6ab6fa07..f95a8f30 100644 --- a/commafeed-client/src/locales/nl/messages.po +++ b/commafeed-client/src/locales/nl/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Wachtwoordherstel" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Wachtwoorden komen niet overeen" diff --git a/commafeed-client/src/locales/nn/messages.po b/commafeed-client/src/locales/nn/messages.po index d64bd953..ae1c78e2 100644 --- a/commafeed-client/src/locales/nn/messages.po +++ b/commafeed-client/src/locales/nn/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Passordgjenoppretting" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Passordene samsvarer ikke" diff --git a/commafeed-client/src/locales/pl/messages.po b/commafeed-client/src/locales/pl/messages.po index 66c7750c..37a47295 100644 --- a/commafeed-client/src/locales/pl/messages.po +++ b/commafeed-client/src/locales/pl/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Odzyskiwanie hasła" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Hasła nie pasują" diff --git a/commafeed-client/src/locales/pt/messages.po b/commafeed-client/src/locales/pt/messages.po index 7992222f..404dbfa9 100644 --- a/commafeed-client/src/locales/pt/messages.po +++ b/commafeed-client/src/locales/pt/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Recuperação de Senha" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Senhas não coincidem" diff --git a/commafeed-client/src/locales/ru/messages.po b/commafeed-client/src/locales/ru/messages.po index 3c7cfcdb..e38c4be3 100644 --- a/commafeed-client/src/locales/ru/messages.po +++ b/commafeed-client/src/locales/ru/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Восстановление пароля" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Пароли не совпадают" diff --git a/commafeed-client/src/locales/sk/messages.po b/commafeed-client/src/locales/sk/messages.po index bd824793..81e281f1 100644 --- a/commafeed-client/src/locales/sk/messages.po +++ b/commafeed-client/src/locales/sk/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Obnovenie hesla" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Heslá sa nezhodujú" diff --git a/commafeed-client/src/locales/sv/messages.po b/commafeed-client/src/locales/sv/messages.po index 0caa7ff9..76dc8eb8 100644 --- a/commafeed-client/src/locales/sv/messages.po +++ b/commafeed-client/src/locales/sv/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Lösenordsåterställning" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Lösenorden matchar inte" diff --git a/commafeed-client/src/locales/tr/messages.po b/commafeed-client/src/locales/tr/messages.po index 663b6733..9080d5cb 100644 --- a/commafeed-client/src/locales/tr/messages.po +++ b/commafeed-client/src/locales/tr/messages.po @@ -794,8 +794,7 @@ msgstr "" msgid "Password Recovery" msgstr "Parola Kurtarma" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "Parolalar eşleşmiyor" diff --git a/commafeed-client/src/locales/zh/messages.po b/commafeed-client/src/locales/zh/messages.po index 0b0d361c..55437a74 100644 --- a/commafeed-client/src/locales/zh/messages.po +++ b/commafeed-client/src/locales/zh/messages.po @@ -794,8 +794,7 @@ msgstr "密码最少需要 {minimumPasswordLength} 个字符" msgid "Password Recovery" msgstr "密码恢复" -#: src/components/settings/ProfileSettings.tsx -#: src/pages/auth/PasswordResetPage.tsx +#: src/hooks/useValidationRules.ts msgid "Passwords do not match" msgstr "密码不匹配" diff --git a/commafeed-client/src/pages/auth/PasswordResetPage.tsx b/commafeed-client/src/pages/auth/PasswordResetPage.tsx index 258c95af..b698ce14 100644 --- a/commafeed-client/src/pages/auth/PasswordResetPage.tsx +++ b/commafeed-client/src/pages/auth/PasswordResetPage.tsx @@ -32,7 +32,7 @@ export function PasswordResetPage() { }, validate: { password: validationRules.password, - passwordConfirmation: (value, values) => (value === values.password ? null : _(msg`Passwords do not match`)), + passwordConfirmation: (value, values) => validationRules.passwordConfirmation(value, values.password), }, validateInputOnChange: true, })