From 3de0e94e1343df0ce2cc8f39de53b1eef87b0a84 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 3 Dec 2015 20:24:37 -0800 Subject: Derive BIP44 wallets from BIP39 seeds on registration, clean up wallet page --- src/routes/users.coffee | 53 ++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/routes/users.coffee b/src/routes/users.coffee index f46c69cf..8ff7f17a 100644 --- a/src/routes/users.coffee +++ b/src/routes/users.coffee @@ -94,34 +94,33 @@ module.exports = (sessions) -> ) ) - if process.env.NODE_ENV is 'production' - require('crypto').randomBytes(48, (ex, buf) -> - token = buf.toString('base64').replace(/\//g,'').replace(/\+/g,'') - db.set("token:#{token}", req.body.username) - host = req.hostname - host += ':3000' if host is 'localhost' - url = "#{req.protocol}://#{host}/verify/#{token}" - - res.render('users/welcome', - user: req.params.user, - layout: 'mail', - url: url, - privkey: req.body.privkey, - js: (-> global.js), - css: (-> global.css), - (err, html) -> - sendgrid = require('sendgrid')(config.sendgrid_user, config.sendgrid_password) - - email = new sendgrid.Email( - to: req.body.email - from: 'adam@coinos.io' - subject: 'Welcome to CoinOS' - html: html - ) - - sendgrid.send(email) - ) + require('crypto').randomBytes(48, (ex, buf) -> + token = buf.toString('base64').replace(/\//g,'').replace(/\+/g,'') + db.set("token:#{token}", req.body.username) + host = req.hostname + host += ':3000' if host is 'localhost' + url = "#{req.protocol}://#{host}/verify/#{token}" + + res.render('users/welcome', + user: req.params.user, + layout: 'mail', + url: url, + privkey: req.body.privkey, + js: (-> global.js), + css: (-> global.css), + (err, html) -> + sendgrid = require('sendgrid')(config.sendgrid_user, config.sendgrid_password) + + email = new sendgrid.Email( + to: req.body.email + from: 'adam@coinos.io' + subject: 'Welcome to CoinOS' + html: html + ) + + sendgrid.send(email) ) + ) ) edit: (req, res) -> -- cgit v1.2.3