mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
lock as onlyAdmin endpoint
This commit is contained in:
parent
d05253c8cd
commit
7321876864
@ -2,7 +2,7 @@ import templates from "../../templates"
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
useContext: ["mailTransporter"],
|
useContext: ["mailTransporter"],
|
||||||
middlewares: ["withAuthentication"],
|
middlewares: ["withAuthentication", "onlyAdmin"],
|
||||||
fn: async (req, res) => {
|
fn: async (req, res) => {
|
||||||
req.body = await req.urlencoded()
|
req.body = await req.urlencoded()
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body = templates[template]({
|
body = templates[template]({
|
||||||
...req.body
|
...req.body,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,21 +22,22 @@ export default {
|
|||||||
from: process.env.SMTP_USERNAME,
|
from: process.env.SMTP_USERNAME,
|
||||||
to: to,
|
to: to,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
html: body
|
html: body,
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(mailOptions)
|
console.log(mailOptions)
|
||||||
|
|
||||||
console.log(`Sending email to ${to}...`)
|
console.log(`Sending email to ${to}...`)
|
||||||
|
|
||||||
const result = await this.default.contexts.mailTransporter.sendMail(mailOptions)
|
const result =
|
||||||
|
await this.default.contexts.mailTransporter.sendMail(mailOptions)
|
||||||
|
|
||||||
console.log("Email sent! >", result)
|
console.log("Email sent! >", result)
|
||||||
|
|
||||||
return res.json({
|
return res.json({
|
||||||
code: 0,
|
code: 0,
|
||||||
message: "ok",
|
message: "ok",
|
||||||
result: result
|
result: result,
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user