forked from projects/fipamo
mailer is an admin method, so added auth check to request
This commit is contained in:
parent
5227b1faa1
commit
09efd3c348
1 changed files with 70 additions and 62 deletions
|
@ -1,11 +1,15 @@
|
|||
import Settings, { SETTINGS_FILE } from '../../data/Settings';
|
||||
import Auth from '../../data/Auth';
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var nodemailer = require('nodemailer');
|
||||
var mg = require('nodemailer-mailgun-transport');
|
||||
const pug = require('pug');
|
||||
const settings = new Settings();
|
||||
const auth = new Auth();
|
||||
router.post('/', function (req, res) {
|
||||
auth.authCheck(req)
|
||||
.then(() => {
|
||||
settings
|
||||
.load(SETTINGS_FILE)
|
||||
.then(settings => {
|
||||
|
@ -71,5 +75,9 @@ router.post('/', function (req, res) {
|
|||
.catch(() => {
|
||||
//console.error(err);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
res.json(err);
|
||||
});
|
||||
});
|
||||
module.exports = router;
|
||||
|
|
Loading…
Reference in a new issue