From 35a8e2b52abf6eef366984a456c944e214702c39 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sat, 1 Oct 2016 21:31:04 -0700 Subject: [PATCH] Fix age old bug with /login redirecting to /register after registration --- package.json | 2 +- src/web/auth.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 638be586..8e108cc7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.22.3", + "version": "3.22.4", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/web/auth.js b/src/web/auth.js index ac3cbcc1..d3bd50ea 100644 --- a/src/web/auth.js +++ b/src/web/auth.js @@ -113,9 +113,13 @@ function handleLoginPage(req, res) { }); } - sendPug(res, "login", { - redirect: req.query.dest || req.header("referer") - }); + var redirect = req.query.dest || req.header("referer"); + var locals = {}; + if (!/\/register/.test(redirect)) { + locals.redirect = redirect; + } + + sendPug(res, "login", locals); } /**