mirror of
https://github.com/sstent/expressmongotest.git
synced 2026-01-25 16:42:00 +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; |