mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 14:43:00 +00:00
migrating repo to Bodyrep org
This commit is contained in:
9
routes/middleware/restrict_user_to_self.js
Normal file
9
routes/middleware/restrict_user_to_self.js
Normal file
@@ -0,0 +1,9 @@
|
||||
function restrictUserToSelf(req, res, next) {
|
||||
if (! req.session.user || req.session.user.username !== req.user.username) {
|
||||
res.send('Unauthorized', 401);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = restrictUserToSelf;
|
||||
Reference in New Issue
Block a user