mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 06:32:11 +00:00
9 lines
226 B
JavaScript
9 lines
226 B
JavaScript
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; |