From 17912f7449417c14534acbbf8e6325623829d974 Mon Sep 17 00:00:00 2001 From: jay-tux Date: Thu, 28 Apr 2022 21:42:32 +0200 Subject: [PATCH] fix: invalid deprecation fix --- backend/routes/reset.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/routes/reset.ts b/backend/routes/reset.ts index c3ef0906..23987e65 100644 --- a/backend/routes/reset.ts +++ b/backend/routes/reset.ts @@ -123,6 +123,10 @@ export async function checkCode( .catch(() => Promise.reject(config.apiErrors.reset.resetFailed)); } +function setSessionKey(req: express.Request, key: string): void { + req.headers.authorization = config.global.authScheme + " " + key; +} + /** * Route that will reset the password when the code and password are valid. * Use route `/reset/:id` with a 'POST' request with body of form @@ -168,6 +172,10 @@ export async function resetPassword( Promise.resolve({ sessionkey: key.session_key }) ); }) + .then((v) => { + setSessionKey(req, v.sessionkey); + return v; + }) .catch(() => Promise.reject(config.apiErrors.reset.resetFailed) );