aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatresstester <[email protected]>2014-05-09 16:09:42 -0700
committermatresstester <[email protected]>2014-05-09 16:09:42 -0700
commit0593170281e8215836ab872b1451e851f15246d9 (patch)
tree8b61f98d3732fe5d97cdeaeef8628436fdb163f7
parent8e2f50f434d373086758a23178e0c83004bb2a85 (diff)
downloadcoinos-server-0593170281e8215836ab872b1451e851f15246d9.tar.gz
coinos-server-0593170281e8215836ab872b1451e851f15246d9.zip
Handle blank passwords
This is because the entire req.body was fed into redis. It's hacky but I'm deleting the whole password value pair before req.body get fed. Also checked changed the password blank check into an existential check
-rw-r--r--routes/users.coffee4
1 files changed, 3 insertions, 1 deletions
diff --git a/routes/users.coffee b/routes/users.coffee
index 1113a4e4..687365c1 100644
--- a/routes/users.coffee
+++ b/routes/users.coffee
@@ -86,8 +86,10 @@ module.exports = (sessions) ->
update: (req, res) ->
return unless req.params.user is req.user.username or
req.user.username is 'admin' or req.user.username is 'ben'
+ if req.body.password is ''
+ delete req.body.password
db.hmset("user:"+req.params.user, req.body, ->
- if req.body.password is ''
+ if not req.body.password?
res.redirect("/#{req.params.user}")
else
bcrypt.hash(req.body.password, 12, (err, hash) ->