Skip to content

Commit

Permalink
Merge pull request #146 from GeographicaGS/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ignacio Domingo Martínez authored Mar 4, 2019
2 parents 93f1716 + 369e6eb commit 935dbfa
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions auth_graph/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ module.exports.password = function (req, res, next) {
var user = data.rows[0];

// Check LDAP USER if necessary
if (user.ldap && ldapopts && ldapopts.forceLdapAuthentication === true) {
if (ldapopts && ldapopts.forceLdapAuthentication === true) {
authLdapUser(password, email, function(err, ldapuser) {
if (err) {
return next(invalidLdapUser());
Expand All @@ -162,8 +162,22 @@ module.exports.password = function (req, res, next) {
});
} else {

if (!user.ldap && ldapopts && ldapopts.forceLdapAuthentication === true) {
return next(invalidUserPassword());
if (user.ldap && ldapopts) {

authLdapUser(password, email, function(err, ldapuser) {
if (err) {
return next(invalidLdapUser());
}
return createdbUserFromLdapUser(ldapuser, password, email, function(err, resUser) {
if (err) {
return next(err);
}
res.user = resUser;
return next();
});

});

}

// Check PASSWORD
Expand Down

0 comments on commit 935dbfa

Please sign in to comment.