verivy email before log in

This commit is contained in:
Dobromir Popov
2024-05-24 19:01:24 +03:00
parent 0f6e094f24
commit a9deca22f0
6 changed files with 128 additions and 12 deletions

View File

@ -114,6 +114,17 @@ exports.SendEmail = async function (to, subject, text, html, attachments = []) {
return result;
};
exports.SendEmail_ValidateTemplate = async function (to, token, firstName, lastName) {
let validateUrl = process.env.NEXTAUTH_URL + "/api/email?action=email_response&emailaction=validateEmail&token=" + token + "&email=" + to;
return await this.SendEmailHandlebars(to, "emailValidate", {
user: to,
validateUrl: validateUrl,
sentDate: common.getDateFormated(new Date())
});
};
exports.SendEmailHandlebars = async function (to, templateName, model, attachments = []) {
try {
// Ensure the sender and mailtrapTestClient are correctly defined or imported

View File

@ -0,0 +1,16 @@
{{!--Subject: ССОМ: Потвърдете имейла си--}}
<section>
<p>Здравей {{user}},</p>
<p>Получихме заявка за вход в сайта за Специално свидетелстване на обществени места в София. </p>
<p>За да потвърдиш твоя достъп моля използвай бутона по долу или <a href="{{validateUrl}}">кликни тук</a>.</p>
<p style="text-align: center;">
<a href="{{validateUrl}}"
target="_blank"
style="background-color: #4CAF50; color: white; padding: 10px 20px; text-decoration: none; display: inline-block; border-radius: 5px;">
Потвърждавам</a>
</p>
</section>
<footer style="margin-top: 20px; text-align: center;">
<p>Изпратено до {{user}} {{sentDate}}</p>
</footer>