mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-03 17:44:44 +02:00
send confirm password reset email
This commit is contained in:
parent
4b34353354
commit
af2d78cbfb
7 changed files with 114 additions and 13 deletions
|
@ -1,3 +1,4 @@
|
|||
import config from "@server/config";
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
import createHttpError from "http-errors";
|
||||
import { z } from "zod";
|
||||
|
@ -15,6 +16,8 @@ import { encodeHex } from "oslo/encoding";
|
|||
import { isWithinExpirationDate } from "oslo";
|
||||
import { invalidateAllSessions } from "@server/auth";
|
||||
import logger from "@server/logger";
|
||||
import ConfirmPasswordReset from "@server/emails/templates/NotifyResetPassword";
|
||||
import { sendEmail } from "@server/emails";
|
||||
|
||||
export const resetPasswordBody = z
|
||||
.object({
|
||||
|
@ -141,7 +144,11 @@ export async function resetPassword(
|
|||
.delete(passwordResetTokens)
|
||||
.where(eq(passwordResetTokens.email, email));
|
||||
|
||||
// TODO: send email to user confirming password reset
|
||||
await sendEmail(ConfirmPasswordReset({ email }), {
|
||||
from: config.email?.no_reply,
|
||||
to: email,
|
||||
subject: "Password Reset Confirmation"
|
||||
})
|
||||
|
||||
return response<ResetPasswordResponse>(res, {
|
||||
data: null,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue