Add lockout logic and email notification utils
All checks were successful
Staging Build / build (push) Successful in 3m34s
All checks were successful
Staging Build / build (push) Successful in 3m34s
This commit is contained in:
25
shop/lib/utils/email.ts
Normal file
25
shop/lib/utils/email.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
'use server'
|
||||
|
||||
import nodemailer from 'nodemailer'
|
||||
|
||||
export async function sendLockoutEmail(to: string) {
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: process.env.SMTP_HOST,
|
||||
port: Number(process.env.SMTP_PORT),
|
||||
secure: process.env.SMTP_SECURE === 'true',
|
||||
auth: {
|
||||
user: process.env.SMTP_USER,
|
||||
pass: process.env.SMTP_PASS,
|
||||
},
|
||||
})
|
||||
|
||||
const message = {
|
||||
from: `"Admin" <${process.env.SMTP_FROM}>`,
|
||||
to,
|
||||
subject: 'Konto gesperrt',
|
||||
text: 'Ihr Konto wurde wegen zu vieler falscher Passwortversuche gesperrt.',
|
||||
html: `<p>Ihr Konto wurde gesperrt, weil das Passwort zu oft falsch eingegeben wurde.</p>`,
|
||||
}
|
||||
|
||||
await transporter.sendMail(message)
|
||||
}
|
||||
Reference in New Issue
Block a user