From 86701a6781b1cbfb42aa93ea64f44f28e6c6b77e Mon Sep 17 00:00:00 2001
From: Rosanny <rosanny.sihombing@hft-stuttgart.de>
Date: Fri, 20 Mar 2020 14:35:18 +0100
Subject: [PATCH] handle error pages

---
 routes/routes-account.js | 6 ++----
 views/DE/404.pug         | 2 +-
 views/DE/500.pug         | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/routes/routes-account.js b/routes/routes-account.js
index b3bbc5e8..48de0f0f 100644
--- a/routes/routes-account.js
+++ b/routes/routes-account.js
@@ -268,22 +268,20 @@ module.exports = function (app, config, passport, i18n) {
           // 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')
+              console.error(err)
               res.status(500).render(lang+'/500', {
                 error: err
               })
-              throw err
             }
             var userPwd = rows[0].password
 
             // check if the password is correct
             bcrypt.compare(currPwd, userPwd, function(err, isMatch) {
               if (err) {
-                //res.redirect('/500')
+                console.error(err)
                 res.status(500).render(lang+'/500', {
                   error: err
                 })
-                throw err
               }
               else if (!isMatch) {
                 //req.flash('error', "Sorry, your password was incorrect. Please double-check your password.")
diff --git a/views/DE/404.pug b/views/DE/404.pug
index a0a6044a..c4178253 100644
--- a/views/DE/404.pug
+++ b/views/DE/404.pug
@@ -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")
         br
         br
-        p 404. The requested URL was not found.
+        p(class="h5") 404. The requested URL was not found.
     // Bootstrap
     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
diff --git a/views/DE/500.pug b/views/DE/500.pug
index 9614b9ed..70457339 100644
--- a/views/DE/500.pug
+++ b/views/DE/500.pug
@@ -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")
         br
         br
-        p 500. Unexpected Error :(
+        p(class="h5") 500. Unexpected Error :(
         p #{ error }
     // Bootstrap
     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
-- 
GitLab