shoc-frontend-new/src/domain/auth/schemas/change-password-schema.ts
Alexandre Brandizzi e6250fba88 feat(account): My Account page with shared password checklist (SH-386)
Adds a My Account page, reachable from the sidebar, with the signed-in
user's read-only details and a Change Password section. The new password
is checked live against the shared password rules (6+ characters, an
uppercase letter, a number and a special character), which the invite
registration flow reuses. The current password is still verified by the
server first, and its rejection is shown on the current password field.
2026-09-25 11:16:59 -03:00

18 lines
631 B
TypeScript

import { z } from "zod";
import { PASSWORDS_DO_NOT_MATCH_MESSAGE, passwordSchema } from "@/domain/auth/password-policy";
export const CURRENT_PASSWORD_INCORRECT_MESSAGE = "Current password is incorrect";
export const changePasswordSchema = z
.object({
currentPassword: z.string().min(1, "Current password is required"),
newPassword: passwordSchema,
confirmPassword: z.string(),
})
.refine((values) => values.newPassword === values.confirmPassword, {
path: ["confirmPassword"],
message: PASSWORDS_DO_NOT_MATCH_MESSAGE,
});
export type ChangePasswordFormValues = z.infer<typeof changePasswordSchema>;