Skip to content

Commit

Permalink
Merge pull request #143 from GeographicaGS/robertosolis/ch34249/be-ba…
Browse files Browse the repository at this point in the history
…dajoz-user-without-pass-if-ldap-forced

Updated ldap to not use password urbo check if ldap forced user. I ha…
  • Loading branch information
Ignacio Domingo Martínez authored Feb 18, 2019
2 parents e73db8f + e11b96b commit ee32a2c
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions auth_graph/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,33 +145,42 @@ module.exports.password = function (req, res, next) {
if (err) {
return next(invalidLdapUser());
}
var um = new usersmodel();
um.editHashedPassword(user.users_id, password, function(err, done) {
user.id = user.users_id;
delete user.password;
delete user.users_id;
res.user = user;
return next();
});
log.info('ldapuser -- ', ldapuser);
if (ldapuser != null ) {
var um = new usersmodel();
um.editHashedPassword(user.users_id, password, function(err, done) {
user.id = user.users_id;
delete user.password;
delete user.users_id;
res.user = user;
return next();
});
}
else {
return next(invalidLdapUser());
}
});
}
} else {

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

// Check PASSWORD
else if (user.password === password) {
user.id = user.users_id;
delete user.password;
delete user.users_id;
res.user = user;
return next();
}
// Check PASSWORD
else if (user.password === password && !user.ldap) {
user.id = user.users_id;
delete user.password;
delete user.users_id;
res.user = user;
return next();
}

else {
return next(invalidUserPassword());
}

else {
return next(invalidUserPassword());
}

}

});
Expand Down

0 comments on commit ee32a2c

Please sign in to comment.