From 15d5175f8dda41b861140e22a768cfea7e625b8b Mon Sep 17 00:00:00 2001 From: Anjali Deep <45489595+anjali142@users.noreply.github.com> Date: Sat, 22 Jun 2019 20:58:22 +0530 Subject: [PATCH] Redirecting to previous page after login(#105) Issue #105 Changes are done in auth.js file of the controls section Changes are done in order to redirect to previous page after login action express-back uses sessions to track the previous path the user visits res.redirect('back') redirects to URL of the previous page that the express-back gives Fixes: #105 --- controls/auth.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controls/auth.js b/controls/auth.js index 6bef8d91..3707a76a 100644 --- a/controls/auth.js +++ b/controls/auth.js @@ -2,6 +2,7 @@ var passport = require('passport'); var user = require('../models/users'); var submissions = require('../models/submission'); var moment = require("moment"); +var back = require("express-back"); /**POST: user signup * route: /user/signup @@ -78,7 +79,7 @@ exports.postLogin = function (req, res) { */ exports.getLogout = function (req, res) { req.logout(); - res.redirect('/'); + res.redirect('back'); } /**Implementing the routing guards */