fu
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 21s

This commit is contained in:
Flummi
2024-01-03 14:47:22 +01:00
parent 64943719da
commit f32d712dff
3 changed files with 11 additions and 38 deletions

View File

@ -1,32 +0,0 @@
import db from '../src/inc/sql.mjs';
import lib from '../src/inc/lib.mjs';
import readline from 'node:readline/promises';
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
const newuser = process.argv[2]?.length ? process.argv[2] : await rl.question('username: ');
const password = await rl.question('password: ');
const level = +(await rl.question('level (0-100): '));
rl.close();
if(!newuser.length || !password.length) {
console.log('nope lol');
process.exit();
}
const id = (await db`
insert into "user" ${
db({
login: newuser.toLowerCase(),
user: newuser,
password: await lib.hash(password),
level: level >= 0 && level <= 100 ? level : 0
})
}
returning id
`)[0]?.id;
console.log(`created new user ${newuser} with ID ${id}`);
process.exit();