Add button to send test email

Fixes #419
This commit is contained in:
Johannes Zellner
2017-09-15 14:21:52 +02:00
parent 09fe957cc7
commit e8a93dcb1b
7 changed files with 85 additions and 5 deletions

View File

@@ -15,7 +15,8 @@ exports = module.exports = {
feedback: feedback,
checkForUpdates: checkForUpdates,
getLogs: getLogs,
getLogStream: getLogStream
getLogStream: getLogStream,
sendTestMail: sendTestMail
};
var assert = require('assert'),
@@ -301,3 +302,13 @@ function getLogStream(req, res, next) {
logStream.on('error', res.end.bind(res, null));
});
}
function sendTestMail(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if (!req.body.email || typeof req.body.email !== 'string') return next(new HttpError(400, 'email must be a non-empty string'));
mailer.sendTestMail(req.body.email);
next(new HttpSuccess(202));
}