From 202a1ef2dce48e5525dbd764fb05e27743da21b8 Mon Sep 17 00:00:00 2001 From: timakasucces Date: Wed, 6 Mar 2019 23:48:37 +0300 Subject: [PATCH] Added message "password not set" to client --- src/app.js | 2 +- src/routes/auth.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app.js b/src/app.js index 54b1cba..9bbf125 100644 --- a/src/app.js +++ b/src/app.js @@ -17,7 +17,7 @@ app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'twig'); require('./utils/twig'); -app.use(logger('dev ')); +app.use(logger('dev')); app.use(express.json()); app.use(express.urlencoded({ extended: true })); app.use(cookieParser()); diff --git a/src/routes/auth.js b/src/routes/auth.js index 8eb861c..795cc8c 100644 --- a/src/routes/auth.js +++ b/src/routes/auth.js @@ -29,7 +29,11 @@ router.post('/auth', parseForm, csrfProtection, async (req, res) => { let userDoc = await Users.get(); if (!userDoc) { - throw new Error('Password not set'); + res.render('auth', { + title: 'Login page', + header: 'Password not set', + csrfToken: req.csrfToken() + }); } const passHash = userDoc.passHash;