aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2014-07-13 23:50:47 -0700
committerAdam Soltys <[email protected]>2014-07-14 20:23:41 -0700
commit3b565f4f4dcea55779e00493e7cf507cf8392010 (patch)
treef9c6ed0ee513c2fa5d83e39733ff43932892f748 /routes
parent3c1282f29695cd102af8b5c49ccf16100a6d03d5 (diff)
downloadcoinos-server-3b565f4f4dcea55779e00493e7cf507cf8392010.tar.gz
coinos-server-3b565f4f4dcea55779e00493e7cf507cf8392010.zip
Confirm password
Diffstat (limited to 'routes')
-rw-r--r--routes/users.coffee9
1 files changed, 9 insertions, 0 deletions
diff --git a/routes/users.coffee b/routes/users.coffee
index 04284d5a..beae3eb0 100644
--- a/routes/users.coffee
+++ b/routes/users.coffee
@@ -53,11 +53,20 @@ module.exports = (sessions) ->
)
create: (req, res) ->
+ errormsg = ""
userkey = "user:"+req.body.username
db.hgetall(userkey, (err, obj) ->
if obj
res.redirect(req.body.username)
else
+ if req.body.confirm != req.body.password
+ errormsg += "Passwords must match"
+ return res.render('users/new',
+ js: (-> global.js),
+ css: (-> global.css),
+ error: errormsg
+ )
+
bcrypt.hash(req.body.password, 12, (err, hash) ->
db.sadd("users",userkey)
db.hmset(userkey,