mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 22:51:37 +00:00
migrating repo to Bodyrep org
This commit is contained in:
11
routes/middleware/is_admin.js
Normal file
11
routes/middleware/is_admin.js
Normal file
@@ -0,0 +1,11 @@
|
||||
function isAdmin(req, res, next) {
|
||||
if (req.session.user.is_admin === false) {
|
||||
console.log("not an admin - sending to profile");
|
||||
res.redirect('/users/' + req.session.user.username);
|
||||
} else {
|
||||
console.log("Admin detected");
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = isAdmin;
|
||||
Reference in New Issue
Block a user