diff options
Diffstat (limited to 'bucky/app/bucky.js')
| -rw-r--r-- | bucky/app/bucky.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index e7455ad..ab30e85 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -324,6 +324,24 @@ var bucky = module.exports = { }) }, + /* PROFILE */ + + ensureUser: function (req, res, next){ + var username = util.sanitizeName(req.params.username) + if (! username) { + return res.sendStatus(404) + } + db.getUserByUsername(username).then(function(user){ + if (user) { + res.user = util.sanitizeUser(user) + next() + } + else { + res.sendStatus(404) + } + }) + }, + /* MAIL */ ensureMailboxes: function (req, res, next){ |
