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) { if (auth) {
content.headers.PAASLDAPAuthTicket = auth.PAASLDAPAuthTicket; content.headers.Cookie = `PAASLDAPAuthTicket=${auth.PAASLDAPAuthTicket};`;
} }
try { try {

View File

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