Skip to content

Commit ee298af

Browse files
fix: update email validation to include pm.me and other email provider domain (calcom#25879)
* fix: update email validation to include pm.me domain and improve error handling in extractDomainFromEmail function * feat(organizations): add pm.me and additional personal email domains - Add pm.me (ProtonMail short domain) to personal email providers list - Add googlemail.com, ymail.com, msn.com, mac.com, and other common personal email domains - Add Mail.com variants (email.com, post.com, consultant.com, etc.) - Add protonmail.ch, gmx.de, naver.com, and other regional providers - Update all three locations: utils.ts, orgCreationUtils.ts, and test file - Fix ESLint warnings for unnecessary escape characters in regex
1 parent 47a5fc7 commit ee298af

3 files changed

Lines changed: 74 additions & 20 deletions

File tree

packages/features/ee/organizations/lib/server/orgCreationUtils.test.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,34 +63,52 @@ describe("orgCreationUtils", () => {
6363
it("should return true for all popular personal email providers", () => {
6464
const personalProviders = [
6565
"gmail.com",
66+
"googlemail.com",
6667
"yahoo.com",
68+
"ymail.com",
69+
"rocketmail.com",
70+
"sbcglobal.net",
71+
"att.net",
6772
"outlook.com",
6873
"hotmail.com",
74+
"live.com",
75+
"msn.com",
76+
"outlook.co",
77+
"hotmail.co.uk",
6978
"aol.com",
7079
"icloud.com",
80+
"me.com",
81+
"mac.com",
7182
"mail.com",
83+
"email.com",
84+
"post.com",
85+
"consultant.com",
86+
"myself.com",
87+
"dr.com",
88+
"europe.com",
89+
"engineer.com",
90+
"asia.com",
91+
"usa.com",
7292
"protonmail.com",
7393
"proton.me",
94+
"pm.me",
95+
"protonmail.ch",
7496
"zoho.com",
7597
"yandex.com",
7698
"gmx.com",
99+
"gmx.de",
77100
"fastmail.com",
78101
"inbox.com",
79-
"me.com",
80102
"hushmail.com",
81-
"live.com",
82103
"rediffmail.com",
83104
"tutanota.com",
84105
"mail.ru",
85-
"usa.com",
86106
"qq.com",
87107
"163.com",
108+
"naver.com",
88109
"web.de",
89-
"rocketmail.com",
90110
"excite.com",
91111
"lycos.com",
92-
"outlook.co",
93-
"hotmail.co.uk",
94112
];
95113

96114
personalProviders.forEach((provider) => {

packages/features/ee/organizations/lib/server/orgCreationUtils.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,52 @@ export function isNotACompanyEmail(email: string) {
2525
// A list of popular @domains that can't be used to allow automatic acceptance of memberships to organization
2626
const emailProviders = [
2727
"gmail.com",
28+
"googlemail.com",
2829
"yahoo.com",
30+
"ymail.com",
31+
"rocketmail.com",
32+
"sbcglobal.net",
33+
"att.net",
2934
"outlook.com",
3035
"hotmail.com",
36+
"live.com",
37+
"msn.com",
38+
"outlook.co",
39+
"hotmail.co.uk",
3140
"aol.com",
3241
"icloud.com",
42+
"me.com",
43+
"mac.com",
3344
"mail.com",
45+
"email.com",
46+
"post.com",
47+
"consultant.com",
48+
"myself.com",
49+
"dr.com",
50+
"europe.com",
51+
"engineer.com",
52+
"asia.com",
53+
"usa.com",
3454
"protonmail.com",
3555
"proton.me",
56+
"pm.me",
57+
"protonmail.ch",
3658
"zoho.com",
3759
"yandex.com",
3860
"gmx.com",
61+
"gmx.de",
3962
"fastmail.com",
4063
"inbox.com",
41-
"me.com",
4264
"hushmail.com",
43-
"live.com",
4465
"rediffmail.com",
4566
"tutanota.com",
4667
"mail.ru",
47-
"usa.com",
4868
"qq.com",
4969
"163.com",
70+
"naver.com",
5071
"web.de",
51-
"rocketmail.com",
5272
"excite.com",
5373
"lycos.com",
54-
"outlook.co",
55-
"hotmail.co.uk",
5674
];
5775

5876
const emailParts = email.split("@");

packages/features/ee/organizations/lib/utils.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export function extractDomainFromEmail(email: string) {
22
let out = "";
33
try {
4-
const match = email.match(/^(?:.*?:\/\/)?.*?([\w\-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[\/?#:]|$)/);
4+
const match = email.match(/^(?:.*?:\/\/)?.*?([\w-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[/?#:]|$)/);
55
out = (match && match[1]) ?? "";
6-
} catch (ignore) {}
6+
} catch { /* empty */ }
77
return out.split(".")[0];
88
}
99

@@ -14,34 +14,52 @@ export function isCompanyEmail(email: string): boolean {
1414
// A list of popular @domains that are personal email providers
1515
const personalEmailProviders = [
1616
"gmail.com",
17+
"googlemail.com",
1718
"yahoo.com",
19+
"ymail.com",
20+
"rocketmail.com",
21+
"sbcglobal.net",
22+
"att.net",
1823
"outlook.com",
1924
"hotmail.com",
25+
"live.com",
26+
"msn.com",
27+
"outlook.co",
28+
"hotmail.co.uk",
2029
"aol.com",
2130
"icloud.com",
31+
"me.com",
32+
"mac.com",
2233
"mail.com",
34+
"email.com",
35+
"post.com",
36+
"consultant.com",
37+
"myself.com",
38+
"dr.com",
39+
"europe.com",
40+
"engineer.com",
41+
"asia.com",
42+
"usa.com",
2343
"protonmail.com",
2444
"proton.me",
45+
"pm.me",
46+
"protonmail.ch",
2547
"zoho.com",
2648
"yandex.com",
2749
"gmx.com",
50+
"gmx.de",
2851
"fastmail.com",
2952
"inbox.com",
30-
"me.com",
3153
"hushmail.com",
32-
"live.com",
3354
"rediffmail.com",
3455
"tutanota.com",
3556
"mail.ru",
36-
"usa.com",
3757
"qq.com",
3858
"163.com",
59+
"naver.com",
3960
"web.de",
40-
"rocketmail.com",
4161
"excite.com",
4262
"lycos.com",
43-
"outlook.co",
44-
"hotmail.co.uk",
4563
];
4664

4765
const emailParts = email.split("@");

0 commit comments

Comments
 (0)