Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #495 from SELab-2/fix-pass-reset
Browse files Browse the repository at this point in the history
fix: invalid deprecation fix
  • Loading branch information
jay-tux authored Apr 28, 2022
2 parents e0ee45a + 17912f7 commit 3232e40
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/routes/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
);
Expand Down

0 comments on commit 3232e40

Please sign in to comment.