fix bugs in paasldap backend and auth password endpoint

This commit is contained in:
Arthur Lu 2024-01-18 21:37:46 +00:00
parent bb047a3782
commit 1ffe9fbe7c
2 changed files with 3 additions and 12 deletions

View File

@ -30,7 +30,7 @@ export default class PAASLDAP extends AUTH_BACKEND {
};
if (auth) {
content.headers.PAASLDAPAuthTicket = auth.PAASLDAPAuthTicket;
content.headers.Cookie = `PAASLDAPAuthTicket=${auth.PAASLDAPAuthTicket};`;
}
try {

View File

@ -104,18 +104,13 @@ router.delete("/ticket", async (req, res) => {
/**
* POST - change user password
* request:
* - binduser: string
* - bindpass: string
* - username: string
* - password: string
* responses:
* - PAAS-LDAP API response
*/
router.post("/password", async (req, res) => {
const params = {
binduser: req.body.binduser,
bindpass: req.body.bindpass,
username: req.body.username,
username: req.cookies.username,
password: req.body.password
};
@ -128,11 +123,7 @@ router.post("/password", async (req, res) => {
const newAttributes = {
userpassword: params.password
};
const bindParams = {
binduser: params.binduser,
bindpass: params.bindpass
};
const response = await handler.modUser(userID, newAttributes, bindParams);
const response = await handler.modUser(userID, newAttributes, req.cookies);
if (response.ok) {
res.status(response.status).send();
}