Skip to content

Commit

Permalink
Merge pull request #145 from GeographicaGS/robertosolis/ch35127/activ…
Browse files Browse the repository at this point in the history
…ate-ldap-in-badajoz-staging-environment

erase check ldap user when forceLdapAuthentication is true
  • Loading branch information
Ignacio Domingo Martínez authored Mar 4, 2019
2 parents ee32a2c + 93043d2 commit 369e6eb
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 369e6eb

Please sign in to comment.