From 2537288b175dd8aeadd7e0c8dcb774dab67d483f Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 18 Jan 2024 21:37:46 +0000 Subject: [PATCH] fix bugs in paasldap backend and auth password endpoint --- src/backends/paasldap.js | 2 +- src/routes/auth.js | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/backends/paasldap.js b/src/backends/paasldap.js index 534ae79..3dbf7d9 100644 --- a/src/backends/paasldap.js +++ b/src/backends/paasldap.js @@ -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 { diff --git a/src/routes/auth.js b/src/routes/auth.js index d0487da..6bdf0bb 100644 --- a/src/routes/auth.js +++ b/src/routes/auth.js @@ -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(); }