From ce73133c4e982db99f218bf930d82eb991ce81e3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 11 Dec 2017 11:17:55 +0100 Subject: profile --- bucky/app/bucky.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bucky/app/bucky.js') 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){ -- cgit v1.2.3-70-g09d2