Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Hubert / Adding function that hides multiple error messages. #6612

Merged
merged 3 commits into from
Jun 23, 2021

Conversation

hubert-deriv
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Jun 15, 2021

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/deriv/binary-static/J7sYfy5nyAMEP1uL5DerUPR5s36k
✅ Preview: https://binary-static-git-fork-hubert-deriv-twoerrorvalidations.binary.sx

@github-actions
Copy link

github-actions bot commented Jun 15, 2021

A production App ID was automatically generated for this PR. (log)

Click here to copy & paste above information.
- **PR**: [https://github.com/binary-com/binary-static/pull/6612](https://github.com/binary-com/binary-static/pull/6612)
- **URLs**:
    - **w/ App ID + Server**: https://binary-static-git-fork-hubert-deriv-twoerrorvalidations.binary.sx/en/logged_inws.html?qa_server=frontend.binaryws.com&app_id=27963
    - **Original**: https://binary-static-git-fork-hubert-deriv-twoerrorvalidations.binary.sx/en/logged_inws.html
- **App ID**: `27963`

@mahdiaryayi-fs
Copy link
Contributor

mahdiaryayi-fs commented Jun 16, 2021

@hubert-deriv

I found that the original issue is something else!
The issue is not that the user can see 2 error messages at the same time
The issue is the regex we are using for Email address validation
That regex is not working properly for detecting all wrong email addresses
just replace the regex for email validation in binary-static/src/javascript/app/common/form_validation.js line 168
from

const validEmail = value => /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/.test(value);

to

const validEmail = value => /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(value);

and the issue is fixed
That regex is from this StackOverflow post: https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript

So we don't need to hide one of the error messages anymore.

@mamali-fs mamali-fs merged commit 81dfa0d into binary-com:master Jun 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants