Skip to content

Commit

Permalink
Redirecting to previous page after login(KamandPrompt#105)
Browse files Browse the repository at this point in the history
Issue KamandPrompt#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: KamandPrompt#105
  • Loading branch information
anjali142 authored Jun 22, 2019
1 parent 35bdb80 commit 15d5175
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controls/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 15d5175

Please sign in to comment.