core: use saslprep to limit usernames

This commit is contained in:
undefined committed 2022-09-13 18:59:04 +08:00
1 parent dbe369d0c6
commit f5828e5cb3
4 files changed
+10 -9

No files matched your search

-4
View File
@@ -75,8 +75,6 @@ export const isEmail = (s) => RE_MAIL.test(s);
export const checkEmail = (s) => { if (!RE_MAIL.test(s)) throw new ValidationError('mail'); else return s; };
export const isContent = (s: any) => s && s.length < 65536;
export const checkContent = (s) => { if (!(s && s.length < 65536)) throw new ValidationError('content'); else return s; };
export const isName = (s) => s && s.length < 256;
export const checkName = (s) => { if (!isName(s)) throw new ValidationError('name'); else return s; };
export const isPid = (s) => RE_PID.test(s.toString());
export const checkPid = (s) => { if (!RE_PID.test(s)) throw new ValidationError('pid'); else return s; };
export const isIntro = () => true;
@@ -102,8 +100,6 @@ global.Hydro.lib.validator = {
checkEmail,
isContent,
checkContent,
isName,
checkName,
isPid,
checkPid,
isIntro,