mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-18 20:59:42 +02:00
14 lines
286 B
JavaScript
14 lines
286 B
JavaScript
|
/**
|
||
|
* Middleware for checking locals.isAuthorized property, which allows to edit/create pages
|
||
|
* @param req
|
||
|
* @param res
|
||
|
* @param next
|
||
|
*/
|
||
|
module.exports = function allowEdit(req, res, next) {
|
||
|
if (res.locals.isAuthorized) {
|
||
|
next();
|
||
|
} else {
|
||
|
res.redirect('/auth');
|
||
|
}
|
||
|
};
|