Commit 86701a67 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

handle error pages

parent 517644a5
...@@ -268,22 +268,20 @@ module.exports = function (app, config, passport, i18n) { ...@@ -268,22 +268,20 @@ module.exports = function (app, config, passport, i18n) {
// Load hashed passwd from DB // Load hashed passwd from DB
dbconn.user.query('SELECT password FROM credential WHERE user_id='+userId, function (err, rows, fields) { dbconn.user.query('SELECT password FROM credential WHERE user_id='+userId, function (err, rows, fields) {
if (err) { if (err) {
//res.redirect('/500') console.error(err)
res.status(500).render(lang+'/500', { res.status(500).render(lang+'/500', {
error: err error: err
}) })
throw err
} }
var userPwd = rows[0].password var userPwd = rows[0].password
// 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') console.error(err)
res.status(500).render(lang+'/500', { res.status(500).render(lang+'/500', {
error: err error: 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.")
......
...@@ -25,6 +25,6 @@ html(lang="de") ...@@ -25,6 +25,6 @@ html(lang="de")
img(src="https://transfer.hft-stuttgart.de/images/demo/m4lab_logo.jpg", class="img-responsive center-block", width="185", height="192") img(src="https://transfer.hft-stuttgart.de/images/demo/m4lab_logo.jpg", class="img-responsive center-block", width="185", height="192")
br br
br br
p 404. The requested URL was not found. p(class="h5") 404. The requested URL was not found.
// Bootstrap // Bootstrap
script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous") script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous")
\ No newline at end of file
...@@ -25,7 +25,7 @@ html(lang="de") ...@@ -25,7 +25,7 @@ html(lang="de")
img(src="https://transfer.hft-stuttgart.de/images/demo/m4lab_logo.jpg", class="img-responsive center-block", width="185", height="192") img(src="https://transfer.hft-stuttgart.de/images/demo/m4lab_logo.jpg", class="img-responsive center-block", width="185", height="192")
br br
br br
p 500. Unexpected Error :( p(class="h5") 500. Unexpected Error :(
p #{ error } p #{ error }
// Bootstrap // Bootstrap
script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous") script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous")
\ No newline at end of file
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