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 Settings, { SETTINGS_FILE } from '../../data/Settings';
|
||||||
|
import Auth from '../../data/Auth';
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var router = express.Router();
|
var router = express.Router();
|
||||||
var nodemailer = require('nodemailer');
|
var nodemailer = require('nodemailer');
|
||||||
var mg = require('nodemailer-mailgun-transport');
|
var mg = require('nodemailer-mailgun-transport');
|
||||||
const pug = require('pug');
|
const pug = require('pug');
|
||||||
const settings = new Settings();
|
const settings = new Settings();
|
||||||
|
const auth = new Auth();
|
||||||
router.post('/', function (req, res) {
|
router.post('/', function (req, res) {
|
||||||
|
auth.authCheck(req)
|
||||||
|
.then(() => {
|
||||||
settings
|
settings
|
||||||
.load(SETTINGS_FILE)
|
.load(SETTINGS_FILE)
|
||||||
.then(settings => {
|
.then(settings => {
|
||||||
|
@ -71,5 +75,9 @@ router.post('/', function (req, res) {
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
//console.error(err);
|
//console.error(err);
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
res.json(err);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
Loading…
Reference in a new issue