Signup data is reaching the server code

This commit is contained in:
2021-01-22 00:55:17 +11:00
parent 30a5251400
commit a983d60b32
17 changed files with 3251 additions and 15 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);
}