const { getNotification } = require('../../notifications/helpers'); function escapeHtml(value) { return String(value) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } module.exports = class EmailOtpEmail { constructor(to, otp, expiresInMinutes) { this.to = to; this.otp = otp; this.expiresInMinutes = expiresInMinutes; } get subject() { return `Kode OTP ${getNotification('app.title')}`; } async html() { const appTitle = escapeHtml(getNotification('app.title')); const otp = escapeHtml(this.otp); const expiresInMinutes = escapeHtml(this.expiresInMinutes); return `
Kode OTP untuk ${appTitle}

Halo,

Gunakan kode berikut untuk masuk atau daftar sebagai Anggota:

${otp}

Kode ini berlaku selama ${expiresInMinutes} menit.

Jika Anda tidak meminta kode ini, abaikan email ini.

`; } };