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) );