Skip to content

Commit

Permalink
fix: Ticket Order: User able to add invalid email (#5690)
Browse files Browse the repository at this point in the history
  • Loading branch information
DIVYAM TAYAL authored Nov 19, 2020
1 parent c874482 commit 7d00804
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/components/forms/orders/order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import moment from 'moment';
import { groupBy, orderBy } from 'lodash-es';
import {
compulsoryProtocolValidUrlPattern, validTwitterProfileUrlPattern, validFacebookProfileUrlPattern,
validGithubProfileUrlPattern
validGithubProfileUrlPattern, validEmail
} from 'open-event-frontend/utils/validators';
import { genders } from 'open-event-frontend/utils/dictionary/genders';
import { ageGroups } from 'open-event-frontend/utils/dictionary/age-groups';
import { countries } from 'open-event-frontend/utils/dictionary/demography';


export default Component.extend(FormMixin, {
router: service(),

Expand Down Expand Up @@ -89,7 +90,8 @@ export default Component.extend(FormMixin, {
prompt : this.l10n.t('Please enter your email')
},
{
type : 'email',
type : 'regExp',
value : validEmail,
prompt : this.l10n.t('Please enter a valid email address')
}
]
Expand Down Expand Up @@ -382,7 +384,8 @@ export default Component.extend(FormMixin, {
identifier : 'email',
rules : [
{
type : 'email',
type : 'regExp',
value : validEmail,
prompt : this.l10n.t('Please enter a valid email address')
}
]
Expand Down
5 changes: 5 additions & 0 deletions app/utils/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ export const validPhoneNumber = new RegExp(
'^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$'
);

export const validEmail = new RegExp(
/* eslint-disable-next-line no-control-regex*/
'[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+'
);

export const isValidUrl = str => {
return validUrlPattern.test(str);
};

1 comment on commit 7d00804

@vercel
Copy link

@vercel vercel bot commented on 7d00804 Nov 19, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.