fix: Incomplete emails are being accepted at user registration (#29115)

* work in progress

* add Error to input box

* Remove console.logs

* fix lint

* fix emailInput and add useDebouncedValue

* change useDebounced time and useForm validation

* fix review

* Create incomplete-emails.md

* fix: simplified changeset

---------

Co-authored-by: Hugo Costa <hugocarreiracosta@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Casals <83978645+casalsgh@users.noreply.github.com>
pull/29459/head^2
Felipe 3 years ago committed by GitHub
parent 916c0dcaf2
commit ae39f91085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .changeset/incomplete-emails.md
  2. 6
      packages/web-ui-registration/src/RegisterForm.tsx

@ -0,0 +1,5 @@
---
"@rocket.chat/web-ui-registration": patch
---
✅ Added a new email validation in the Registration Form

@ -100,9 +100,13 @@ export const RegisterForm = ({ setLoginRoute }: { setLoginRoute: DispatchLoginRo
<TextInput
{...register('email', {
required: true,
pattern: {
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
message: t('registration.component.form.invalidEmail'),
},
})}
placeholder={usernameOrEmailPlaceholder || t('registration.component.form.emailPlaceholder')}
error={errors.email && t('registration.component.form.requiredField')}
error={errors.email && t('registration.component.form.invalidEmail')}
name='email'
aria-invalid={errors.email ? 'true' : undefined}
id='email'

Loading…
Cancel
Save