UNPKG

aegis-auth

Version:

A credentials-based auth solution for Next.js (and other Node projects) with IP rate-limiting, account lockouts, and sessions in DB.

38 lines 1.19 kB
import { sendEmail } from "./sendEmail"; export async function sendVerificationEmail(options) { var _a, _b; const { toEmail, token, config } = options; let html; if ((_b = (_a = config.email) === null || _a === void 0 ? void 0 : _a.templates) === null || _b === void 0 ? void 0 : _b.verification) { html = config.email.templates.verification({ token, toEmail }); } else { html = ` <html> <body> <p>Please verify your email address by clicking the link below:</p> <a href="${config.email.baseUrl}/verify-email?token=${token}">Verify Email</a> </body> </html> `; } const sendOption = { to: toEmail, subject: "Verify your email", html: html, config: config, }; try { const result = await sendEmail(sendOption); config.logger.info("Verification email sent", { toEmail, result }); return result; } catch (error) { config.logger.error("Failed to send verification email", { toEmail, error, }); throw error; } } //# sourceMappingURL=sendVerificationEmail.js.map