mirror of
https://github.com/mollersuite/monofile.git
synced 2024-10-06 20:16:25 -07:00
disable mail when not available
This commit is contained in:
parent
82f3c31df2
commit
87c7b3295c
|
@ -20,7 +20,9 @@ const transport = createTransport({
|
||||||
* @param content Email content
|
* @param content Email content
|
||||||
* @returns Promise which resolves to the output from nodemailer.transport.sendMail
|
* @returns Promise which resolves to the output from nodemailer.transport.sendMail
|
||||||
*/
|
*/
|
||||||
export function sendMail(to: string, subject: string, content: string) {
|
export async function sendMail(to: string, subject: string, content: string) {
|
||||||
|
if (!config.mail.enabled) return false
|
||||||
|
|
||||||
return transport.sendMail({
|
return transport.sendMail({
|
||||||
to,
|
to,
|
||||||
subject,
|
subject,
|
||||||
|
|
|
@ -93,6 +93,8 @@ const validators: {
|
||||||
requireProofOfIdentity: true,
|
requireProofOfIdentity: true,
|
||||||
validator: (actor, target, params, ctx) => {
|
validator: (actor, target, params, ctx) => {
|
||||||
|
|
||||||
|
if (!Configuration.mail.enabled) return [501, "email not enabled on instance"]
|
||||||
|
|
||||||
if (!params.email) {
|
if (!params.email) {
|
||||||
if (target.email) {
|
if (target.email) {
|
||||||
sendMail(
|
sendMail(
|
||||||
|
|
Loading…
Reference in a new issue