css
This commit is contained in:
parent
d0cc234857
commit
d8f720856c
11 changed files with 321 additions and 24 deletions
|
@ -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
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue