mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: user: update email normalization (#812)
This commit is contained in:
1 parent
f38cf6e02a
commit
1a981b9bf5
2 files changed
+5
-8
No files matched your search
@@ -177,7 +177,8 @@ export class User {
|
|||||||
|
|
||||||
function handleMailLower(mail: string) {
|
function handleMailLower(mail: string) {
|
||||||
const [n, d] = mail.trim().toLowerCase().split('@');
|
const [n, d] = mail.trim().toLowerCase().split('@');
|
||||||
return `${n.replace(/\./g, '').replace(/\+.$/, '')}@${d === 'googlemail.com' ? 'gmail.com' : d}`;
|
const [name] = n.split('+');
|
||||||
|
return `${name.replace(/\./g, '')}@${d === 'googlemail.com' ? 'gmail.com' : d}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initAndCache(udoc: Udoc, dudoc, scope: bigint = PERM.PERM_ALL) {
|
async function initAndCache(udoc: Udoc, dudoc, scope: bigint = PERM.PERM_ALL) {
|
||||||
|
|||||||
@@ -36,13 +36,9 @@ const langMap = {
|
|||||||
Python3: 'py.py3',
|
Python3: 'py.py3',
|
||||||
};
|
};
|
||||||
function handleMailLower(mail: string) {
|
function handleMailLower(mail: string) {
|
||||||
let data = mail.trim().toLowerCase();
|
const [n, d] = mail.trim().toLowerCase().split('@');
|
||||||
if (data.endsWith('@googlemail.com')) data = data.replace('@googlemail.com', '@gmail.com');
|
const [name] = n.split('+');
|
||||||
if (data.endsWith('@gmail.com')) {
|
return `${name.replace(/\./g, '')}@${d === 'googlemail.com' ? 'gmail.com' : d}`;
|
||||||
const [prev] = data.split('@');
|
|
||||||
data = `${prev.replace(/[.+]/g, '')}@gmail.com`;
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function run({
|
export async function run({
|
||||||
|
|||||||
Reference in new issue
Block a user