Compare commits
1 commit
2bab63b2b9
...
4f7d43a6c2
Author | SHA1 | Date | |
---|---|---|---|
4f7d43a6c2 |
2 changed files with 12 additions and 2 deletions
|
@ -50,7 +50,7 @@ function LoginFormElement({
|
||||||
return (
|
return (
|
||||||
<form className='flex flex-col gap-5 w-full' onSubmit={onSubmit}>
|
<form className='flex flex-col gap-5 w-full' onSubmit={onSubmit}>
|
||||||
<LabeledInput
|
<LabeledInput
|
||||||
type='email'
|
type='text'
|
||||||
label='E-Mail or Username'
|
label='E-Mail or Username'
|
||||||
placeholder='What you are known as'
|
placeholder='What you are known as'
|
||||||
error={formState.errors.email?.message}
|
error={formState.errors.email?.message}
|
||||||
|
|
|
@ -4,7 +4,17 @@ export const loginSchema = zod.object({
|
||||||
email: zod
|
email: zod
|
||||||
.string()
|
.string()
|
||||||
.email('Invalid email address')
|
.email('Invalid email address')
|
||||||
.min(3, 'Email is required'),
|
.min(3, 'Email is required')
|
||||||
|
.or(
|
||||||
|
zod
|
||||||
|
.string()
|
||||||
|
.min(3, 'Username is required')
|
||||||
|
.max(32, 'Username must be at most 32 characters long')
|
||||||
|
.regex(
|
||||||
|
/^[a-zA-Z0-9_]+$/,
|
||||||
|
'Username can only contain letters, numbers, and underscores',
|
||||||
|
),
|
||||||
|
),
|
||||||
password: zod.string().min(1, 'Password is required'),
|
password: zod.string().min(1, 'Password is required'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue