mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Merge dev into added_docs
This commit is contained in:
commit
0ad80c4a22
@ -373,7 +373,6 @@ export function normalizeEmail(email: string): string {
|
||||
throw new TypeError('normalize-email expects a string');
|
||||
}
|
||||
|
||||
const removeDotsDomains = ['gmail.com', 'googlemail.com', 'live.com'];
|
||||
|
||||
const emailLower = email.trim().toLowerCase();
|
||||
const emailParts = emailLower.split(/@/);
|
||||
@ -384,16 +383,12 @@ export function normalizeEmail(email: string): string {
|
||||
|
||||
let [username, domain] = emailParts;
|
||||
|
||||
if (removeDotsDomains.includes(domain)) {
|
||||
username = username.replace(/\.+/g, '');
|
||||
}
|
||||
|
||||
return `${username}@${domain}`;
|
||||
}
|
||||
|
||||
import.meta.vitest?.test('normalizeEmail(...)', async ({ expect }) => {
|
||||
expect(normalizeEmail('Example.Test@gmail.com')).toBe('exampletest@gmail.com');
|
||||
expect(normalizeEmail('Example.Test+123@gmail.com')).toBe('exampletest+123@gmail.com');
|
||||
expect(normalizeEmail('Example.Test@gmail.com')).toBe('example.test@gmail.com');
|
||||
expect(normalizeEmail('Example.Test+123@gmail.com')).toBe('example.test+123@gmail.com');
|
||||
expect(normalizeEmail('exampletest@gmail.com')).toBe('exampletest@gmail.com');
|
||||
expect(normalizeEmail('EXAMPLETEST@gmail.com')).toBe('exampletest@gmail.com');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user