fix(mobile): say the passwords do not match when saving a new password

Save stayed disabled while the confirmation differed, so tapping it did
nothing and the mismatch message was only reachable from the keyboard.
Save is now enabled once every field is filled and reports the mismatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DIYgod
2026-10-12 21:13:21 +08:00
parent cf66870969
commit cecf2f39e9
@@ -29,8 +29,8 @@ export const ResetPassword = () => {
const [newPassword, setNewPassword] = useState("")
const [confirmNewPassword, setConfirmNewPassword] = useState("")
const isFormValid =
!!currentPassword && !!newPassword && !!confirmNewPassword && newPassword === confirmNewPassword
const isFormFilled = !!currentPassword && !!newPassword && !!confirmNewPassword
const isFormValid = isFormFilled && newPassword === confirmNewPassword
const { mutate: submitChangePassword, isPending } = useMutation({
mutationFn: async () => {
@@ -80,11 +80,13 @@ export const ResetPassword = () => {
<CheckLineIcon height={18} width={18} color={labelColor} />
)
}
disabled={!isFormValid || isPending}
// Enabled once every field is filled, so saving a confirmation that does not
// match says so instead of doing nothing
disabled={!isFormFilled || isPending}
onPress={handleSave}
/>
),
[handleSave, isFormValid, isPending, labelColor, t],
[handleSave, isFormFilled, isPending, labelColor, t],
)}
/>
}