Skip to content

Commit

Permalink
Merge pull request #144 from GeographicaGS/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ignacio Domingo Martínez authored Feb 18, 2019
2 parents bc15dbe + ee32a2c commit 93f1716
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 93f1716

Please sign in to comment.