fix: update email validation to include pm.me and other email provider domain (#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
This commit is contained in:
@@ -63,34 +63,52 @@ describe("orgCreationUtils", () => {
|
||||
it("should return true for all popular personal email providers", () => {
|
||||
const personalProviders = [
|
||||
"gmail.com",
|
||||
"googlemail.com",
|
||||
"yahoo.com",
|
||||
"ymail.com",
|
||||
"rocketmail.com",
|
||||
"sbcglobal.net",
|
||||
"att.net",
|
||||
"outlook.com",
|
||||
"hotmail.com",
|
||||
"live.com",
|
||||
"msn.com",
|
||||
"outlook.co",
|
||||
"hotmail.co.uk",
|
||||
"aol.com",
|
||||
"icloud.com",
|
||||
"me.com",
|
||||
"mac.com",
|
||||
"mail.com",
|
||||
"email.com",
|
||||
"post.com",
|
||||
"consultant.com",
|
||||
"myself.com",
|
||||
"dr.com",
|
||||
"europe.com",
|
||||
"engineer.com",
|
||||
"asia.com",
|
||||
"usa.com",
|
||||
"protonmail.com",
|
||||
"proton.me",
|
||||
"pm.me",
|
||||
"protonmail.ch",
|
||||
"zoho.com",
|
||||
"yandex.com",
|
||||
"gmx.com",
|
||||
"gmx.de",
|
||||
"fastmail.com",
|
||||
"inbox.com",
|
||||
"me.com",
|
||||
"hushmail.com",
|
||||
"live.com",
|
||||
"rediffmail.com",
|
||||
"tutanota.com",
|
||||
"mail.ru",
|
||||
"usa.com",
|
||||
"qq.com",
|
||||
"163.com",
|
||||
"naver.com",
|
||||
"web.de",
|
||||
"rocketmail.com",
|
||||
"excite.com",
|
||||
"lycos.com",
|
||||
"outlook.co",
|
||||
"hotmail.co.uk",
|
||||
];
|
||||
|
||||
personalProviders.forEach((provider) => {
|
||||
|
||||
@@ -25,34 +25,52 @@ export function isNotACompanyEmail(email: string) {
|
||||
// A list of popular @domains that can't be used to allow automatic acceptance of memberships to organization
|
||||
const emailProviders = [
|
||||
"gmail.com",
|
||||
"googlemail.com",
|
||||
"yahoo.com",
|
||||
"ymail.com",
|
||||
"rocketmail.com",
|
||||
"sbcglobal.net",
|
||||
"att.net",
|
||||
"outlook.com",
|
||||
"hotmail.com",
|
||||
"live.com",
|
||||
"msn.com",
|
||||
"outlook.co",
|
||||
"hotmail.co.uk",
|
||||
"aol.com",
|
||||
"icloud.com",
|
||||
"me.com",
|
||||
"mac.com",
|
||||
"mail.com",
|
||||
"email.com",
|
||||
"post.com",
|
||||
"consultant.com",
|
||||
"myself.com",
|
||||
"dr.com",
|
||||
"europe.com",
|
||||
"engineer.com",
|
||||
"asia.com",
|
||||
"usa.com",
|
||||
"protonmail.com",
|
||||
"proton.me",
|
||||
"pm.me",
|
||||
"protonmail.ch",
|
||||
"zoho.com",
|
||||
"yandex.com",
|
||||
"gmx.com",
|
||||
"gmx.de",
|
||||
"fastmail.com",
|
||||
"inbox.com",
|
||||
"me.com",
|
||||
"hushmail.com",
|
||||
"live.com",
|
||||
"rediffmail.com",
|
||||
"tutanota.com",
|
||||
"mail.ru",
|
||||
"usa.com",
|
||||
"qq.com",
|
||||
"163.com",
|
||||
"naver.com",
|
||||
"web.de",
|
||||
"rocketmail.com",
|
||||
"excite.com",
|
||||
"lycos.com",
|
||||
"outlook.co",
|
||||
"hotmail.co.uk",
|
||||
];
|
||||
|
||||
const emailParts = email.split("@");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export function extractDomainFromEmail(email: string) {
|
||||
let out = "";
|
||||
try {
|
||||
const match = email.match(/^(?:.*?:\/\/)?.*?([\w\-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[\/?#:]|$)/);
|
||||
const match = email.match(/^(?:.*?:\/\/)?.*?([\w-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[/?#:]|$)/);
|
||||
out = (match && match[1]) ?? "";
|
||||
} catch (ignore) {}
|
||||
} catch { /* empty */ }
|
||||
return out.split(".")[0];
|
||||
}
|
||||
|
||||
@@ -14,34 +14,52 @@ export function isCompanyEmail(email: string): boolean {
|
||||
// A list of popular @domains that are personal email providers
|
||||
const personalEmailProviders = [
|
||||
"gmail.com",
|
||||
"googlemail.com",
|
||||
"yahoo.com",
|
||||
"ymail.com",
|
||||
"rocketmail.com",
|
||||
"sbcglobal.net",
|
||||
"att.net",
|
||||
"outlook.com",
|
||||
"hotmail.com",
|
||||
"live.com",
|
||||
"msn.com",
|
||||
"outlook.co",
|
||||
"hotmail.co.uk",
|
||||
"aol.com",
|
||||
"icloud.com",
|
||||
"me.com",
|
||||
"mac.com",
|
||||
"mail.com",
|
||||
"email.com",
|
||||
"post.com",
|
||||
"consultant.com",
|
||||
"myself.com",
|
||||
"dr.com",
|
||||
"europe.com",
|
||||
"engineer.com",
|
||||
"asia.com",
|
||||
"usa.com",
|
||||
"protonmail.com",
|
||||
"proton.me",
|
||||
"pm.me",
|
||||
"protonmail.ch",
|
||||
"zoho.com",
|
||||
"yandex.com",
|
||||
"gmx.com",
|
||||
"gmx.de",
|
||||
"fastmail.com",
|
||||
"inbox.com",
|
||||
"me.com",
|
||||
"hushmail.com",
|
||||
"live.com",
|
||||
"rediffmail.com",
|
||||
"tutanota.com",
|
||||
"mail.ru",
|
||||
"usa.com",
|
||||
"qq.com",
|
||||
"163.com",
|
||||
"naver.com",
|
||||
"web.de",
|
||||
"rocketmail.com",
|
||||
"excite.com",
|
||||
"lycos.com",
|
||||
"outlook.co",
|
||||
"hotmail.co.uk",
|
||||
];
|
||||
|
||||
const emailParts = email.split("@");
|
||||
|
||||
Reference in New Issue
Block a user