This commit is contained in:
biglyderv 2024-11-25 14:12:43 -05:00
parent 153c74bd22
commit 9287290479
11 changed files with 321 additions and 24 deletions

View file

@ -6,18 +6,12 @@ import { randomBytes } from 'node:crypto';
let db = await initDb();
function isValid(user) {
return user.search(/[^A-Za-z0-9\-\_]/g) == -1;
}
// TODO: rewrite
let main = new Route([], async function (req, res, input) {
let { user, pass } = req.body;
if (!pass || !user) return { 'success': false, 'message': 'Some fields are missing' };
if (!isValid(user)) return { 'success': false, 'message': 'Username is invalid' };
let isExist = await db.all('SELECT * FROM auth WHERE UPPER(username) LIKE UPPER(?)', [
user
]);