From bc84634f47c14e7a3331d8a9bdbb24e07944298e Mon Sep 17 00:00:00 2001 From: Zuxxied Date: Sat, 19 Oct 2024 15:38:13 -0400 Subject: [PATCH] aa --- client/login.js | 2 +- form/login.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/login.js b/client/login.js index f73191a..3ee7540 100644 --- a/client/login.js +++ b/client/login.js @@ -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 }); diff --git a/form/login.js b/form/login.js index 3e9df62..802ea14 100644 --- a/form/login.js +++ b/form/login.js @@ -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; \ No newline at end of file