Skip to content

Commit

Permalink
separated auth password routes into verify + confirm reset
Browse files Browse the repository at this point in the history
  • Loading branch information
trinity-y committed Sep 26, 2024
1 parent 5229aaa commit f54a9d3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions backend/typescript/rest/authRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,26 @@ authRouter.post(
authRouter.post("/verifyPasswordCode",
async (req, res) => {
try {
await authService.verifyPasswordResetCode(req.body.oobCode)
res.status(204)
const email = await authService.verifyPasswordResetCode(req.body.oobCode)
res.status(200).json({email: email})
} catch (error: unknown) {

res.status(500).json({ error: getErrorMessage(error) });
}
}
)

authRouter.post(
"/firstTimePasswordChange/",
authRouter.post("/confirmPasswordRest",
async (req, res) => {
try {
await authService.firstTimePasswordChange(req.body.oobCode, req.body.newPassword )
res.status(204).send()
} catch (error: unknown) {
const wasResetSuccessful = await authService.confirmPasswordReset(req.body.oobCode, req.body.newPassword)
if (wasResetSuccessful) {
res.status(204).send()
} else {
res.status(500).json({ error: "Error from Firebase while resetting password."});
}
} catch (error) {
res.status(500).json({ error: getErrorMessage(error) });
}
}
)
// is this too specific to be a route
authRouter.post("/getEmailFromOobCode")

export default authRouter;

0 comments on commit f54a9d3

Please sign in to comment.