mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-05-19 05:56:39 +02:00
fix: space are not allowed on login form
This commit is contained in:
parent
65f3590a5a
commit
c6f8f3cf7c
|
@ -99,33 +99,24 @@ export default function Login() {
|
||||||
placeholder='Username'
|
placeholder='Username'
|
||||||
className='signInInput'
|
className='signInInput'
|
||||||
{...register('username', {
|
{...register('username', {
|
||||||
required: true,
|
required: 'This field is required.',
|
||||||
|
pattern: {
|
||||||
|
value: /^[^\s]+$/g,
|
||||||
|
message: 'No space allowed.',
|
||||||
|
},
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
{errors.email &&
|
{errors.username && (
|
||||||
errors.email.type === 'required' && (
|
<small
|
||||||
<small
|
style={{
|
||||||
style={{
|
color: 'red',
|
||||||
color: 'red',
|
display: 'block',
|
||||||
display: 'block',
|
marginTop: '3px',
|
||||||
marginTop: '3px',
|
}}
|
||||||
}}
|
>
|
||||||
>
|
{errors.username.message}
|
||||||
This field is required.
|
</small>
|
||||||
</small>
|
)}
|
||||||
)}
|
|
||||||
{errors.email &&
|
|
||||||
errors.email.type === 'pattern' && (
|
|
||||||
<small
|
|
||||||
style={{
|
|
||||||
color: 'red',
|
|
||||||
display: 'block',
|
|
||||||
marginTop: '3px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Incorrect email address format.
|
|
||||||
</small>
|
|
||||||
)}
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input
|
<input
|
||||||
|
@ -133,7 +124,7 @@ export default function Login() {
|
||||||
placeholder='Password'
|
placeholder='Password'
|
||||||
className='signInInput'
|
className='signInInput'
|
||||||
{...register('password', {
|
{...register('password', {
|
||||||
required: true,
|
required: 'This field is required.',
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
{errors.password && (
|
{errors.password && (
|
||||||
|
@ -144,7 +135,7 @@ export default function Login() {
|
||||||
marginTop: '3px',
|
marginTop: '3px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
This field is required.
|
{errors.password.message}
|
||||||
</small>
|
</small>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue