Blacklist functionality
Some API improvements
This commit is contained in:
parent
c343e4efd3
commit
9203b5cee7
40 changed files with 726 additions and 398 deletions
27
routes/rest/blacklist.js
Normal file
27
routes/rest/blacklist.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
const passport = require('../../lib/passport');
|
||||
const blacklist = require('../../models/blacklist');
|
||||
|
||||
const router = require('../../lib/router-async').create();
|
||||
|
||||
|
||||
router.postAsync('/blacklist-table', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await blacklist.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/blacklist', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await blacklist.add(req.context, req.body.email);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.deleteAsync('/blacklist/:email', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await blacklist.remove(req.context, req.params.email);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.postAsync('/blacklist-validate', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await blacklist.serverValidate(req.context, req.body));
|
||||
});
|
||||
|
||||
module.exports = router;
|
Loading…
Add table
Add a link
Reference in a new issue