Converted the account system to an auth system

This commit is contained in:
2021-03-07 00:41:19 +11:00
parent 725842f672
commit 2e024f71c3
27 changed files with 4495 additions and 7 deletions
+23
View File
@@ -0,0 +1,23 @@
module.exports = username => {
if (!username) {
return false;
}
if (username.length < 8 && username.length > 100) {
return false;
}
if (!isAlpha(username)) {
return false;
}
return true;
}
const isAlpha = (str) => {
//starting from beginning ^
//to the end $
//check first letter is alpha or underscore [A-Za-z_]
//check the remaining 0 or more (*) letters are alpha, numeric or underscore [A-Za-z0-9_]
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(str);
}