summaryrefslogtreecommitdiff
path: root/bucky/app/bucky.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-11 11:17:55 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-11 11:17:55 +0100
commitce73133c4e982db99f218bf930d82eb991ce81e3 (patch)
treecb15654419b8e912296ac9cea6deef068099910a /bucky/app/bucky.js
parentb6992903b7fe2a0aad9e6e47b0c14122b448b11c (diff)
profile
Diffstat (limited to 'bucky/app/bucky.js')
-rw-r--r--bucky/app/bucky.js18
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){