make password match rule reusable

This commit is contained in:
Athou
2026-01-20 08:54:23 +01:00
parent afe957ba59
commit 3c8ac35a46
31 changed files with 32 additions and 59 deletions

View File

@@ -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<FormData>({
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,
})