Commit 6bf99da2 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

merge conflict: wrong db host

parents 001f428f 339ce36f
Pipeline #407 passed with stage
in 7 seconds
......@@ -124,14 +124,14 @@ module.exports = function (app, config, passport) {
app.get('/login',
passport.authenticate(config.passport.strategy,
{
successRedirect: '/',
failureRedirect: '/login'
successRedirect: '/account/',
failureRedirect: '/account/login'
})
);
app.get('/logout', function (req, res) {
if (req.user == null) {
return res.redirect('/');
return res.redirect('/account/');
}
req.user.nameID = req.user.id;
......@@ -162,7 +162,7 @@ module.exports = function (app, config, passport) {
}
})
} else {
res.redirect('/login');
res.redirect('/account/login');
}
});
......@@ -226,7 +226,7 @@ module.exports = function (app, config, passport) {
}
])
} else {
res.redirect('/login');
res.redirect('/account/login');
}
});
......@@ -236,7 +236,7 @@ module.exports = function (app, config, passport) {
user: req.user // useful for view engine, useless for HTML
});
} else {
res.redirect('/login');
res.redirect('/account/login');
}
});
......@@ -261,11 +261,11 @@ module.exports = function (app, config, passport) {
else {
req.flash('success', 'Profile updated!');
}
res.redirect('/profile');
res.redirect('/account/profile');
})
}
} else {
res.redirect('/login');
res.redirect('/account/login');
}
});
......@@ -280,7 +280,7 @@ module.exports = function (app, config, passport) {
// Load hashed passwd from DB
dbconn.user.query('SELECT password FROM credential WHERE user_id='+userId, function (err, rows, fields) {
if (err) {
res.redirect('/500')
res.redirect('/account/500')
throw err
}
var userPwd = rows[0].password
......@@ -288,17 +288,17 @@ module.exports = function (app, config, passport) {
// check if the password is correct
bcrypt.compare(currPwd, userPwd, function(err, isMatch) {
if (err) {
res.redirect('/500')
res.redirect('/account/500')
throw err
}
else if (!isMatch) {
req.flash('error', "Sorry, your password was incorrect. Please double-check your password.")
res.redirect('/security')
res.redirect('/account/security')
}
else {
if ( newPwd != retypePwd ) {
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 {
// update password
......@@ -324,7 +324,7 @@ module.exports = function (app, config, passport) {
}
});
}
res.redirect('/security')
res.redirect('/account/security')
})
});
});
......@@ -336,7 +336,7 @@ module.exports = function (app, config, passport) {
})
}
else {
res.redirect('/login');
res.redirect('/account/login');
}
});
......@@ -369,7 +369,7 @@ module.exports = function (app, config, passport) {
emailSubject = "M4_LAB Password Reset";
emailContent = "Hi User,\n\n"+
"we've received a request to reset your password. If you didn't make the request, just ignore this email.\n\n"+
"Otherwise, you can reset your password using this link: http://localhost:9989/reset/" + token + "\n" +
"Otherwise, you can reset your password using this link: http://m4lab.hft-stuttgart.de/account/reset/" + token + "\n" +
"This password reset is only valid for 1 hour.\n\n"+
"Thanks,\nM4_LAB Team"
......@@ -402,7 +402,7 @@ module.exports = function (app, config, passport) {
else {
req.flash('success', 'An e-mail has been sent to ' + emailAddress + ' with further instructions.');
}
res.redirect('/forgotPwd');
res.redirect('/account/forgotPwd');
});
});
......@@ -410,7 +410,7 @@ module.exports = function (app, config, passport) {
methods.getUserByToken(req.params.token, function(err, user){
if (!user) {
req.flash('error', 'Password reset token is invalid or has expired.');
res.redirect('/forgotPwd');
res.redirect('/account/forgotPwd');
}
else {
res.render('reset');
......@@ -447,7 +447,7 @@ module.exports = function (app, config, passport) {
}
});
// redirect to login page
res.redirect('/login')
res.redirect('/account/login')
}
})
});
......@@ -455,7 +455,7 @@ module.exports = function (app, config, passport) {
}
else {
req.flash('error', "User not found.")
res.redirect('/login')
res.redirect('/account/login')
}
});
......@@ -498,7 +498,7 @@ module.exports = function (app, config, passport) {
else {
req.flash('success', 'Your account has been created. Please log in.');
}
res.redirect('/registration');
res.redirect('/account/registration');
})
});
});
......
Supports Markdown
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