New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Update email validation #4577
fix: Update email validation #4577
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/8smxq93av |
Codecov Report
@@ Coverage Diff @@
## development #4577 +/- ##
===============================================
- Coverage 22.21% 22.21% -0.01%
===============================================
Files 473 473
Lines 4973 4975 +2
Branches 8 8
===============================================
Hits 1105 1105
- Misses 3867 3869 +2
Partials 1 1
Continue to review full report at Codecov.
|
It seems that those emails are invalid but they are not. We won't be adding custom regex to validate emails. Instead, the app should handle errors from backend gracefully and show proper error |
app/controllers/register.js
Outdated
@@ -31,6 +31,8 @@ export default class RegisterController extends Controller { | |||
.catch(reason => { | |||
if (reason && Object.prototype.hasOwnProperty.call(reason, 'errors') && reason.errors[0].status === 409) { | |||
this.set('errorMessage', this.l10n.t('User already exists.')); | |||
} else if (reason && Object.prototype.hasOwnProperty.call(reason, 'errors') && reason.errors[0].status === '422') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (reason && Object.prototype.hasOwnProperty.call(reason, 'errors') && reason.errors[0].status === '422') { | |
} else if (reason?.errors[0]?.status === '422') { |
@iamareebjamal please review this pr again. |
Will test it today and merge. Thanks for reminding |
Fixes #4399
Short description of what this resolves:
The email specified in this issue is invalid, so this pull request resolves the error of validating an email without ".com", ".io", etc.
The code for validating an email id using the "email" identifier which is validating the email id without ".com", so by changing the email identifier by regular expression resolves this issue.
Changes proposed in this pull request:
Changes "email" identifier by "regExp[/^A-Za-z0-9_@A-Za-z0-9_(.[A-Za-z0-9_]{2,3})+$/]" in app/components/forms/login-form.js
Checklist
development
branch.