diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-05-14 18:54:22 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-05-14 18:54:22 +0200 |
| commit | e79bdedb819415792eea49de7483885046d2a368 (patch) | |
| tree | 9931fa389c1459347593155dd09a7c2cf3ecc009 /bucky/app/bucky.js | |
| parent | afd20e776ba207be9c4a00d29cb61dd3ea760eef (diff) | |
change password form working
Diffstat (limited to 'bucky/app/bucky.js')
| -rw-r--r-- | bucky/app/bucky.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index f00c296..70cfeec 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -547,6 +547,22 @@ var bucky = module.exports = { } }) }, + ensureUserFromBody: function (req, res, next){ + var username = util.sanitizeName(req.body.username) + if (! username) { + return res.sendStatus(404) + } + db.getUserByUsername(username).then(function(user){ + if (user) { + res.user = user + next() + } + else { + console.log('no such user!!') + res.sendStatus(404) + } + }) + }, sanitizeUser: function(req, res, next) { res.user = util.sanitizeUser(res.user) next() |
