Chain login to use getSessionUser to fill all the correct fields

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-10-11 20:38:19 -07:00
parent 873efac52f
commit 734fc13967

View File

@ -287,11 +287,12 @@ router.post("/login", function(req, res) {
/* We use LDAP as the primary authenticator; if the user is not
* found there, we look the user up in the site-specific user database */
return ldapPromise(username, password).then(function(user) {
user.name = user.displayName;
user.username = user.uid;
return ldapPromise(username, password).then(function(ldap) {
let user = {};
user.name = ldap.displayName;
user.username = ldap.uid;
user.id = "LDAP";
user.mail = user.mail;
user.mail = ldap.mail;
user.authenticated = 1;
user.mailVerified = 1;
req.session.userId = "LDAP";
@ -332,9 +333,9 @@ router.post("/login", function(req, res) {
console.log(message);
}
delete user.id;
return res.status(200).send(user);
return getSessionUser(req).then(function(user) {
return res.status(200).send(user);
});
});
});