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:
parent
873efac52f
commit
734fc13967
@ -287,11 +287,12 @@ router.post("/login", function(req, res) {
|
|||||||
/* We use LDAP as the primary authenticator; if the user is not
|
/* 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 */
|
* found there, we look the user up in the site-specific user database */
|
||||||
|
|
||||||
return ldapPromise(username, password).then(function(user) {
|
return ldapPromise(username, password).then(function(ldap) {
|
||||||
user.name = user.displayName;
|
let user = {};
|
||||||
user.username = user.uid;
|
user.name = ldap.displayName;
|
||||||
|
user.username = ldap.uid;
|
||||||
user.id = "LDAP";
|
user.id = "LDAP";
|
||||||
user.mail = user.mail;
|
user.mail = ldap.mail;
|
||||||
user.authenticated = 1;
|
user.authenticated = 1;
|
||||||
user.mailVerified = 1;
|
user.mailVerified = 1;
|
||||||
req.session.userId = "LDAP";
|
req.session.userId = "LDAP";
|
||||||
@ -332,10 +333,10 @@ router.post("/login", function(req, res) {
|
|||||||
console.log(message);
|
console.log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete user.id;
|
return getSessionUser(req).then(function(user) {
|
||||||
|
|
||||||
return res.status(200).send(user);
|
return res.status(200).send(user);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/logout", function(req, res) {
|
router.get("/logout", function(req, res) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user