From 18e0809a99aedf72f6e0696b362c918212a32a6b Mon Sep 17 00:00:00 2001 From: VLE2FE Date: Thu, 6 Aug 2020 11:40:29 +0200 Subject: [PATCH] fixed mail in user.ts --- src/helpers/mail.ts | 2 +- src/routes/user.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/mail.ts b/src/helpers/mail.ts index 901c5f5..c8291d1 100644 --- a/src/helpers/mail.ts +++ b/src/helpers/mail.ts @@ -55,7 +55,7 @@ export default class Mail{ }); } - static send (mailAddress, subject, content, f = () => {}) { // callback, executed empty or with error + static send (mailAddress, subject, content, f: (x?) => void = () => {}) { // callback, executed empty or with error if (process.env.NODE_ENV === 'production') { // only send mails in production axios({ method: 'post', diff --git a/src/routes/user.ts b/src/routes/user.ts index 7b43449..c8ebdc2 100644 --- a/src/routes/user.ts +++ b/src/routes/user.ts @@ -5,7 +5,7 @@ import _ from 'lodash'; import UserValidate from './validate/user'; import UserModel from '../models/user'; -import mail from '../helpers/mail'; +import Mail from '../helpers/mail'; import res400 from './validate/res400'; import db from '../db'; @@ -133,7 +133,7 @@ router.post('/user/passreset', (req, res, next) => { if (err) return next(err); // send email - mail(data[0].email, 'Your new password for the DeFinMa database', + Mail.send(data[0].email, 'Your new password for the DeFinMa database', 'Hi,

You requested to reset your password.
Your new password is:

' + newPass + '' + '

If you did not request a password reset, talk to the sysadmin quickly!

Have a nice day.' + '

The DeFinMa team', err => {