mirror of
https://github.com/ragestudio/comty.git
synced 2025-07-11 02:04:15 +00:00
fix event
This commit is contained in:
parent
61ba0670f2
commit
d05253c8cd
@ -1,26 +1,35 @@
|
|||||||
import templates from "../templates"
|
import templates from "../templates"
|
||||||
|
|
||||||
export default async (ctx, data) => {
|
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) {
|
console.log(`Sending password recovery email to ${email}`)
|
||||||
throw new OperationError(400, "Bad request")
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await ctx.mailTransporter.sendMail({
|
if (
|
||||||
from: process.env.SMTP_USERNAME,
|
!username ||
|
||||||
to: email,
|
!email ||
|
||||||
subject: "Password reset",
|
!code ||
|
||||||
html: templates.password_recovery({
|
!created_at ||
|
||||||
username: username,
|
!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),
|
return result
|
||||||
ip: ip_address,
|
|
||||||
client: client,
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user