fixed token generation

pull/19/head
tycrek 3 years ago
parent bc78e821d8
commit 99c1349121
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -17,7 +17,7 @@ if (require.main === module) {
auth.tokens.push(token); auth.tokens.push(token);
// Generate the user // Generate the user
let username = process.argv[2] ? process.argv[2].replace(/[^\da-z]/gi, '').substring(0, MAX_USERNAME) : randomGen(20); let username = process.argv[2] ? process.argv[2].replace(/[^\da-z]/gi, '').substring(0, MAX_USERNAME) : randomGen({ length: 20 });
if (!auth.users) auth.users = {}; if (!auth.users) auth.users = {};
if (Object.values(auth.users).findIndex((user) => user.username == username) != -1) { if (Object.values(auth.users).findIndex((user) => user.username == username) != -1) {
console.log('Username already exists!'); console.log('Username already exists!');

Loading…
Cancel
Save