summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/app.js b/app.js
index 44054961..e3ce93de 100644
--- a/app.js
+++ b/app.js
@@ -382,9 +382,15 @@ if (config.google) {
}
// ldap auth
if (config.ldap) {
- app.post('/auth/ldap', urlencodedParser,
- passport.authenticate('ldapauth', { successRedirect: '/' })
- );
+ app.post('/auth/ldap', urlencodedParser, function (req, res, next) {
+ if (!req.body.username || !req.body.password) return response.errorBadRequest(res);
+ setReturnToFromReferer(req);
+ passport.authenticate('ldapauth', {
+ successReturnToOrRedirect: config.serverurl + '/',
+ failureRedirect: config.serverurl + '/',
+ failureFlash: true
+ })(req, res, next);
+ });
}
// email auth
if (config.email) {