Commit 231c1f60 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

changed redirect paths relative to account

parent 00fe9e79
...@@ -70,19 +70,19 @@ module.exports = function (app, config, passport) { ...@@ -70,19 +70,19 @@ module.exports = function (app, config, passport) {
app.get('/login', app.get('/login',
passport.authenticate(config.passport.strategy, passport.authenticate(config.passport.strategy,
{ {
successRedirect: '/account', successRedirect: '/account/',
failureRedirect: '/login' failureRedirect: '/account/login'
}) })
); );
app.post(config.passport.saml.path, app.post(config.passport.saml.path,
passport.authenticate(config.passport.strategy, passport.authenticate(config.passport.strategy,
{ {
failureRedirect: '/', failureRedirect: '/account/',
failureFlash: true failureFlash: true
}), }),
function (req, res) { function (req, res) {
res.redirect('/'); res.redirect('/account/');
} }
); );
...@@ -92,7 +92,7 @@ module.exports = function (app, config, passport) { ...@@ -92,7 +92,7 @@ module.exports = function (app, config, passport) {
user: req.user // useful for view engine, useless for HTML user: req.user // useful for view engine, useless for HTML
}); });
} else { } else {
res.redirect('/login'); res.redirect('/account/login');
} }
}); });
...@@ -156,7 +156,7 @@ module.exports = function (app, config, passport) { ...@@ -156,7 +156,7 @@ module.exports = function (app, config, passport) {
} }
]) ])
} else { } else {
res.redirect('/login'); res.redirect('/account/login');
} }
}); });
...@@ -166,7 +166,7 @@ module.exports = function (app, config, passport) { ...@@ -166,7 +166,7 @@ module.exports = function (app, config, passport) {
user: req.user // useful for view engine, useless for HTML user: req.user // useful for view engine, useless for HTML
}); });
} else { } else {
res.redirect('/login'); res.redirect('/account/login');
} }
}); });
...@@ -191,11 +191,11 @@ module.exports = function (app, config, passport) { ...@@ -191,11 +191,11 @@ module.exports = function (app, config, passport) {
else { else {
req.flash('success', 'Profile updated!'); req.flash('success', 'Profile updated!');
} }
res.redirect('/profile'); res.redirect('/account/profile');
}) })
} }
} else { } else {
res.redirect('/login'); res.redirect('/account/login');
} }
}); });
...@@ -210,7 +210,7 @@ module.exports = function (app, config, passport) { ...@@ -210,7 +210,7 @@ module.exports = function (app, config, passport) {
// Load hashed passwd from DB. // Load hashed passwd from DB.
dbconn.user.query('SELECT password FROM user WHERE email="'+req.user.email+'"', function (err, rows, fields) { dbconn.user.query('SELECT password FROM user WHERE email="'+req.user.email+'"', function (err, rows, fields) {
if (err) { if (err) {
res.redirect('/500') res.redirect('/account/500')
throw err throw err
} }
var userPwd = rows[0].password var userPwd = rows[0].password
...@@ -218,16 +218,16 @@ module.exports = function (app, config, passport) { ...@@ -218,16 +218,16 @@ module.exports = function (app, config, passport) {
// check if the password is correct // check if the password is correct
bcrypt.compare(currPwd, userPwd, function(err, isMatch) { bcrypt.compare(currPwd, userPwd, function(err, isMatch) {
if (err) { if (err) {
res.redirect('/500') res.redirect('/account/500')
throw err throw err
} }
else if (!isMatch) { else if (!isMatch) {
req.flash('error', "Sorry, your password was incorrect. Please double-check your password.") req.flash('error', "Sorry, your password was incorrect. Please double-check your password.")
res.redirect('/security') res.redirect('/account/security')
} else { } else {
if ( newPwd != retypePwd ) { if ( newPwd != retypePwd ) {
req.flash('error', "Passwords do no match. Please make sure you re-type your new password correctly.") req.flash('error', "Passwords do no match. Please make sure you re-type your new password correctly.")
res.redirect('/security') res.redirect('/account/security')
} }
else { else {
// update password // update password
...@@ -242,7 +242,7 @@ module.exports = function (app, config, passport) { ...@@ -242,7 +242,7 @@ module.exports = function (app, config, passport) {
req.flash('success', "Pasword updated!") req.flash('success', "Pasword updated!")
console.log('pasword updated!') console.log('pasword updated!')
} }
res.redirect('/security') res.redirect('/account/security')
}) })
}); });
}); });
...@@ -251,7 +251,7 @@ module.exports = function (app, config, passport) { ...@@ -251,7 +251,7 @@ module.exports = function (app, config, passport) {
}) })
}) })
} else { } else {
res.redirect('/login'); res.redirect('/account/login');
} }
}); });
...@@ -345,7 +345,7 @@ module.exports = function (app, config, passport) { ...@@ -345,7 +345,7 @@ module.exports = function (app, config, passport) {
else { else {
req.flash('success', 'An e-mail has been sent to ' + emailAddress + ' with further instructions.'); req.flash('success', 'An e-mail has been sent to ' + emailAddress + ' with further instructions.');
} }
res.redirect('/forgotPwd'); res.redirect('/account/forgotPwd');
}); });
}); });
...@@ -354,7 +354,7 @@ module.exports = function (app, config, passport) { ...@@ -354,7 +354,7 @@ module.exports = function (app, config, passport) {
//console.log(user); //console.log(user);
if (!user) { if (!user) {
req.flash('error', 'Password reset token is invalid or has expired.'); req.flash('error', 'Password reset token is invalid or has expired.');
res.redirect('/forgotPwd'); res.redirect('/account/forgotPwd');
} }
else { else {
res.render('reset'); res.render('reset');
...@@ -387,12 +387,12 @@ module.exports = function (app, config, passport) { ...@@ -387,12 +387,12 @@ module.exports = function (app, config, passport) {
} }
}); });
res.redirect('/login') res.redirect('/account/login')
}); });
app.get('/logout', function (req, res) { app.get('/logout', function (req, res) {
if (req.user == null) { if (req.user == null) {
return res.redirect('/'); return res.redirect('/account/');
} }
req.user.nameID = req.user.id; req.user.nameID = req.user.id;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment