Skip to content

Commit

Permalink
fix: Incomplete emails are being accepted at user registration (#29115)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Casals <[email protected]>
  • Loading branch information
4 people authored Jun 16, 2023
1 parent 916c0dc commit ae39f91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/incomplete-emails.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/web-ui-registration": patch
---

✅ Added a new email validation in the Registration Form
6 changes: 5 additions & 1 deletion packages/web-ui-registration/src/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit ae39f91

Please sign in to comment.