Skip to content

Commit 7d00804

Browse files
author
DIVYAM TAYAL
authored
fix: Ticket Order: User able to add invalid email (#5690)
1 parent c874482 commit 7d00804

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

app/components/forms/orders/order-form.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import moment from 'moment';
88
import { groupBy, orderBy } from 'lodash-es';
99
import {
1010
compulsoryProtocolValidUrlPattern, validTwitterProfileUrlPattern, validFacebookProfileUrlPattern,
11-
validGithubProfileUrlPattern
11+
validGithubProfileUrlPattern, validEmail
1212
} from 'open-event-frontend/utils/validators';
1313
import { genders } from 'open-event-frontend/utils/dictionary/genders';
1414
import { ageGroups } from 'open-event-frontend/utils/dictionary/age-groups';
1515
import { countries } from 'open-event-frontend/utils/dictionary/demography';
1616

17+
1718
export default Component.extend(FormMixin, {
1819
router: service(),
1920

@@ -89,7 +90,8 @@ export default Component.extend(FormMixin, {
8990
prompt : this.l10n.t('Please enter your email')
9091
},
9192
{
92-
type : 'email',
93+
type : 'regExp',
94+
value : validEmail,
9395
prompt : this.l10n.t('Please enter a valid email address')
9496
}
9597
]
@@ -382,7 +384,8 @@ export default Component.extend(FormMixin, {
382384
identifier : 'email',
383385
rules : [
384386
{
385-
type : 'email',
387+
type : 'regExp',
388+
value : validEmail,
386389
prompt : this.l10n.t('Please enter a valid email address')
387390
}
388391
]

app/utils/validators.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ export const validPhoneNumber = new RegExp(
7979
'^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$'
8080
);
8181

82+
export const validEmail = new RegExp(
83+
/* eslint-disable-next-line no-control-regex*/
84+
'[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+'
85+
);
86+
8287
export const isValidUrl = str => {
8388
return validUrlPattern.test(str);
8489
};

0 commit comments

Comments
 (0)