Skip to content
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

Merged

Conversation

himanshuvarandani
Copy link
Contributor

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

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@auto-label auto-label bot added the fix label Jul 18, 2020
@vercel
Copy link

vercel bot commented Jul 18, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/8smxq93av
✅ Preview: https://open-event-frontend-git-fork-himanshuvarandani-himanshu-patch-1.eventyay.vercel.app

@codecov
Copy link

codecov bot commented Jul 18, 2020

Codecov Report

Merging #4577 into development will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@               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              
Impacted Files Coverage Δ
app/controllers/register.js 34.28% <0.00%> (-2.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2a99ef...0f356b1. Read the comment docs.

@iamareebjamal
Copy link
Member

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

@@ -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') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if (reason && Object.prototype.hasOwnProperty.call(reason, 'errors') && reason.errors[0].status === '422') {
} else if (reason?.errors[0]?.status === '422') {

@himanshuvarandani
Copy link
Contributor Author

@iamareebjamal please review this pr again.
What I have to do next in this pr to merge?

@iamareebjamal
Copy link
Member

Will test it today and merge. Thanks for reminding

@iamareebjamal iamareebjamal merged commit 7254e23 into fossasia:development Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Add specific error in Registration validation
2 participants