mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
LDAP login improvements
- return bad request if no username or password given - return to referer url on auth success - flash error message on auth failure
This commit is contained in:
parent
3007163799
commit
fc8d709afb
1 changed files with 9 additions and 3 deletions
12
app.js
12
app.js
|
@ -382,9 +382,15 @@ if (config.google) {
|
||||||
}
|
}
|
||||||
// ldap auth
|
// ldap auth
|
||||||
if (config.ldap) {
|
if (config.ldap) {
|
||||||
app.post('/auth/ldap', urlencodedParser,
|
app.post('/auth/ldap', urlencodedParser, function (req, res, next) {
|
||||||
passport.authenticate('ldapauth', { successRedirect: '/' })
|
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
|
// email auth
|
||||||
if (config.email) {
|
if (config.email) {
|
||||||
|
|
Loading…
Reference in a new issue