aboutsummaryrefslogtreecommitdiff
path: root/src/auth.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/auth.js')
-rw-r--r--src/auth.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/auth.js b/src/auth.js
index 78e3dea..f040a08 100644
--- a/src/auth.js
+++ b/src/auth.js
@@ -27,7 +27,9 @@ function authenticateToken(req, res, next) {
27 27
28function authenticateAdmin(req, res, next) { 28function authenticateAdmin(req, res, next) {
29 if (!req.cookies || !req.cookies.auth_token) { 29 if (!req.cookies || !req.cookies.auth_token) {
30 return res.redirect("/login"); 30 return res.redirect(
31 `/login?redirect=${encodeURIComponent(req.originalUrl)}`,
32 );
31 } 33 }
32 34
33 const token = req.cookies.auth_token; 35 const token = req.cookies.auth_token;