Files
klz-cables.com/.pnpm-store/v10/files/f3/92e47eb95e2aafc32fc2d42f89f63ff1bc00c89b781aa96718aa920a59b46e17bdff3c44b5534bf3a15d5e6ee26432503a57c024170fe3c7d68dbc15a053e1
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

46 lines
1.7 KiB
Plaintext

import { URL } from 'url';
import { formatAdminURL } from '../utilities/formatAdminURL.js';
export async function sendVerificationEmail(args) {
// Verify token from e-mail
const { collection: { config: collectionConfig }, config, disableEmail, email, req, token, user } = args;
if (!disableEmail) {
const protocol = new URL(req.url).protocol // includes the final :
;
const serverURL = config.serverURL !== null && config.serverURL !== '' ? config.serverURL : `${protocol}//${req.headers.get('host')}`;
const verificationURL = formatAdminURL({
adminRoute: config.routes.admin,
path: `/${collectionConfig.slug}/verify/${token}`,
serverURL
});
let html = `${req.t('authentication:newAccountCreated', {
serverURL: config.serverURL,
verificationURL
})}`;
const verify = collectionConfig.auth.verify;
// Allow config to override email content
if (typeof verify.generateEmailHTML === 'function') {
html = await verify.generateEmailHTML({
req,
token,
user
});
}
let subject = req.t('authentication:verifyYourEmail');
// Allow config to override email subject
if (typeof verify.generateEmailSubject === 'function') {
subject = await verify.generateEmailSubject({
req,
token,
user
});
}
await email.sendEmail({
from: `"${email.defaultFromName}" <${email.defaultFromAddress}>`,
html,
subject,
to: user.email
});
}
}
//# sourceMappingURL=sendVerificationEmail.js.map