"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Email; var _nodemailer = require("nodemailer"); function Email(options) { return { id: "email", type: "email", name: "Email", server: { host: "localhost", port: 25, auth: { user: "", pass: "" } }, from: "NextAuth ", maxAge: 24 * 60 * 60, async sendVerificationRequest(params) { const { identifier, url, provider, theme } = params; const { host } = new URL(url); const transport = (0, _nodemailer.createTransport)(provider.server); const result = await transport.sendMail({ to: identifier, from: provider.from, subject: `Sign in to ${host}`, text: text({ url, host }), html: html({ url, host, theme }) }); const failed = result.rejected.concat(result.pending).filter(Boolean); if (failed.length) { throw new Error(`Email (${failed.join(", ")}) could not be sent`); } }, options }; } function html(params) { const { url, host, theme } = params; const escapedHost = host.replace(/\./g, "​."); const brandColor = theme.brandColor || "#346df1"; const buttonText = theme.buttonText || "#fff"; const color = { background: "#f9f9f9", text: "#444", mainBackground: "#fff", buttonBackground: brandColor, buttonBorder: brandColor, buttonText }; return `
Sign in to ${escapedHost}
Sign in
If you did not request this email you can safely ignore it.
`; } function text({ url, host }) { return `Sign in to ${host}\n${url}\n\n`; }