aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
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,