added email verification

This commit is contained in:
PxlLoewe
2025-05-30 01:06:28 -07:00
parent 0cebe2b97e
commit b0caf56add
20 changed files with 459 additions and 232 deletions

View File

@@ -1,5 +1,5 @@
import { Router } from "express";
import { sendMail } from "modules/mail";
import { sendEmailVerification, sendMail } from "modules/mail";
import { sendPasswordChanged, sendCourseCompletedEmail } from "modules/mail";
const router: Router = Router();
@@ -45,6 +45,12 @@ router.post("/template/:template", async (req, res) => {
}
await sendCourseCompletedEmail(to, data.user, data.event);
break;
case "email-verification":
if (!data.code) {
res.status(400).json({ error: "Missing verification code" });
return;
}
await sendEmailVerification(to, data.user, data.code);
default:
res.status(400).json({ error: "Invalid template" });
return;