This commit is contained in:
biglyderv 2024-10-19 15:38:13 -04:00
parent 9d8577c923
commit bc84634f47
2 changed files with 3 additions and 3 deletions

View file

@ -9,7 +9,7 @@ let main = new Route([auth], async function (req, res, input) {
{ label: "Username", type: "text", name: "user" },
{ label: "Password", type: "password", name: "pass" },
],
'route': '/api/form/login',
'route': '/api/form/login?redir=' + req.query.redirect,
'title': 'Login',
username
});

View file

@ -8,7 +8,7 @@ let db = await initDb();
// TODO: rewrite
let main = new Route([], async function (req, res, input) {
let { user, pass, redir } = req.body;
let { user, pass } = req.body;
if (!pass || !user) return { 'success': false, 'message': 'Some fields are missing' };
@ -32,7 +32,7 @@ let main = new Route([], async function (req, res, input) {
res.cookie('token',token);
return {'success': true, 'message': 'Log in succeeded', 'redirect': redir || '/', 'data': token};
return {'success': true, 'message': 'Log in succeeded', 'redirect': req.query.redirect || '/', 'data': token};
});
export default main;