fix event

This commit is contained in:
SrGooglo 2025-02-25 23:09:46 +00:00
parent 61ba0670f2
commit d05253c8cd

View File

@ -1,26 +1,35 @@
import templates from "../templates"
export default async (ctx, data) => {
const { user_id, username, email, apr_link, created_at, expires_at, ip_address, client } = data
const { code, created_at, expires_at, ip_address, client } = data
const { email, username } = data.user
if (!user_id || !username || !email || !apr_link || !created_at || !expires_at || !ip_address || !client) {
throw new OperationError(400, "Bad request")
}
console.log(`Sending password recovery email to ${email}`)
const result = await ctx.mailTransporter.sendMail({
from: process.env.SMTP_USERNAME,
to: email,
subject: "Password reset",
html: templates.password_recovery({
username: username,
if (
!username ||
!email ||
!code ||
!created_at ||
!expires_at ||
!ip_address ||
!client
) {
throw new OperationError(400, "Bad request")
}
apr_link: apr_link,
const result = await ctx.mailTransporter.sendMail({
from: process.env.SMTP_USERNAME,
to: email,
subject: "Password reset",
html: templates.password_recovery({
username: username,
code: code,
date: new Date(created_at),
ip: ip_address,
client: client,
}),
})
date: new Date(created_at),
ip: ip_address,
client: client,
}),
})
return result
return result
}