mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
fix: improve the validation message for documenso app (#640)
* fix: improve the validation message * fix: improve the validation message --------- Co-authored-by: Catalin Pit <catalinpit@gmail.com>
This commit is contained in:
@ -20,9 +20,18 @@ import { FormErrorMessage } from '../form/form-error-message';
|
|||||||
|
|
||||||
export const ZPasswordFormSchema = z
|
export const ZPasswordFormSchema = z
|
||||||
.object({
|
.object({
|
||||||
currentPassword: z.string().min(6).max(72),
|
currentPassword: z
|
||||||
password: z.string().min(6).max(72),
|
.string()
|
||||||
repeatedPassword: z.string().min(6).max(72),
|
.min(6, { message: 'Password should contain at least 6 characters' })
|
||||||
|
.max(72, { message: 'Password should not contain more than 72 characters' }),
|
||||||
|
password: z
|
||||||
|
.string()
|
||||||
|
.min(6, { message: 'Password should contain at least 6 characters' })
|
||||||
|
.max(72, { message: 'Password should not contain more than 72 characters' }),
|
||||||
|
repeatedPassword: z
|
||||||
|
.string()
|
||||||
|
.min(6, { message: 'Password should contain at least 6 characters' })
|
||||||
|
.max(72, { message: 'Password should not contain more than 72 characters' }),
|
||||||
})
|
})
|
||||||
.refine((data) => data.password === data.repeatedPassword, {
|
.refine((data) => data.password === data.repeatedPassword, {
|
||||||
message: 'Passwords do not match',
|
message: 'Passwords do not match',
|
||||||
|
|||||||
@ -28,7 +28,7 @@ const LOGIN_REDIRECT_PATH = '/documents';
|
|||||||
|
|
||||||
export const ZSignInFormSchema = z.object({
|
export const ZSignInFormSchema = z.object({
|
||||||
email: z.string().email().min(1),
|
email: z.string().email().min(1),
|
||||||
password: z.string().min(6).max(72),
|
password: z.string().min(6, { message: 'Invalid password' }).max(72),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TSignInFormSchema = z.infer<typeof ZSignInFormSchema>;
|
export type TSignInFormSchema = z.infer<typeof ZSignInFormSchema>;
|
||||||
|
|||||||
@ -21,7 +21,10 @@ import { useToast } from '@documenso/ui/primitives/use-toast';
|
|||||||
export const ZSignUpFormSchema = z.object({
|
export const ZSignUpFormSchema = z.object({
|
||||||
name: z.string().trim().min(1, { message: 'Please enter a valid name.' }),
|
name: z.string().trim().min(1, { message: 'Please enter a valid name.' }),
|
||||||
email: z.string().email().min(1),
|
email: z.string().email().min(1),
|
||||||
password: z.string().min(6).max(72),
|
password: z
|
||||||
|
.string()
|
||||||
|
.min(6, { message: 'Password should contain at least 6 characters' })
|
||||||
|
.max(72, { message: 'Password should not contain more than 72 characters' }),
|
||||||
signature: z.string().min(1, { message: 'We need your signature to sign documents' }),
|
signature: z.string().min(1, { message: 'We need your signature to sign documents' }),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -134,6 +137,7 @@ export const SignUpForm = ({ className }: SignUpFormProps) => {
|
|||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<FormErrorMessage className="mt-1.5" error={errors.password} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export const ZAddSignersFormSchema = z
|
|||||||
z.object({
|
z.object({
|
||||||
formId: z.string().min(1),
|
formId: z.string().min(1),
|
||||||
nativeId: z.number().optional(),
|
nativeId: z.number().optional(),
|
||||||
email: z.string().min(1).email(),
|
email: z.string().email().min(1),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user