Error message if login failed
This commit is contained in:
parent
aa88b397d8
commit
1b37c6e755
|
@ -1,12 +1,12 @@
|
|||
extends ../../../templates/base.pug
|
||||
|
||||
block content
|
||||
if loginFailed
|
||||
.alert
|
||||
| Username or password incorrect. Please try again.
|
||||
.row
|
||||
.col
|
||||
.col
|
||||
if loginFailed
|
||||
.alert.alert-danger
|
||||
| Username or password incorrect. Please try again.
|
||||
form(method="POST", action=getUrl("loginTarget"))
|
||||
.form-group
|
||||
input.form-control(type="text", name="username", placeholder="Username", autofocus)
|
||||
|
|
|
@ -19,6 +19,11 @@ module.exports.redirectIfNotLogged = function(redirectionPage, toDecorate) {
|
|||
}
|
||||
|
||||
module.exports.login = function(req, res, render) {
|
||||
if (req.session.loginFailed !== undefined) {
|
||||
res.locals.loginFailed = req.session.loginFailed;
|
||||
req.session.loginFailed = undefined;
|
||||
req.session.save();
|
||||
}
|
||||
render('login.pug');
|
||||
}
|
||||
|
||||
|
@ -46,6 +51,8 @@ module.exports.loginTarget = function(req, res, render) {
|
|||
|
||||
res.redirect(getUrl(redirection));
|
||||
} else {
|
||||
req.session.loginFailed = true;
|
||||
req.session.save();
|
||||
res.redirect(getUrl('login'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ html
|
|||
| Log out
|
||||
.container
|
||||
block content
|
||||
|
||||
script(src='/static/bootstrap/js/jquery.min.js')
|
||||
script(src='/static/bootstrap/js/popper.min.js')
|
||||
script(src='/static/bootstrap/js/bootstrap.min.js')
|
||||
|
|
Loading…
Reference in New Issue