From 7f77ec2c5f35a83107565935378243dc4d6cba6e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 28 May 2013 11:50:09 -0400 Subject: [PATCH] committing hotfix to registration --- public/css/style.less | 2 +- public/templates/header.tpl | 1 + src/user.js | 68 +++++++++++++++++++------------------ src/webserver.js | 5 ++- 4 files changed, 41 insertions(+), 35 deletions(-) diff --git a/public/css/style.less b/public/css/style.less index 8447be7b1a..6225e3d571 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -638,7 +638,7 @@ footer.footer { .category-row h4 { font-weight: 700; text-align: left; - color: #555; + /*color: #555;*/ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/public/templates/header.tpl b/public/templates/header.tpl index 8e9ca1b19a..2b95d4fe18 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -6,6 +6,7 @@ + diff --git a/src/user.js b/src/user.js index 008e93838c..06f18e2431 100644 --- a/src/user.js +++ b/src/user.js @@ -355,39 +355,41 @@ var utils = require('./../public/src/utils.js'), } User.sendConfirmationEmail = function (email) { - var confirm_code = utils.generateUUID(), - confirm_link = config.url + 'confirm/' + confirm_code, - confirm_email = global.templates['emails/header'] + global.templates['emails/email_confirm'].parse({'CONFIRM_LINK': confirm_link}) + global.templates['emails/footer'], - confirm_email_plaintext = global.templates['emails/email_confirm_plaintext'].parse({ 'CONFIRM_LINK': confirm_link }); - - // Email confirmation code - var expiry_time = 60*60*2, // Expire after 2 hours - email_key = 'email:' + email + ':confirm', - confirm_key = 'confirm:' + confirm_code + ':email'; - - RDB.set(email_key, confirm_code); - RDB.expire(email_key, expiry_time); - RDB.set(confirm_key, email); - RDB.expire(confirm_key, expiry_time); - - // Send intro email w/ confirm code - var message = emailjs.message.create({ - text: confirm_email_plaintext, - from: config.mailer.from, - to: email, - subject: '[NodeBB] Registration Email Verification', - attachment: [ - { - data: confirm_email, - alternative: true - } - ] - }); - - emailjsServer.send(message, function(err, success) { - if (err) - console.log(err); - }); + if (global.config['email:host'] && global.config['email:port'] && global.config['email:from']) { + var confirm_code = utils.generateUUID(), + confirm_link = config.url + 'confirm/' + confirm_code, + confirm_email = global.templates['emails/header'] + global.templates['emails/email_confirm'].parse({'CONFIRM_LINK': confirm_link}) + global.templates['emails/footer'], + confirm_email_plaintext = global.templates['emails/email_confirm_plaintext'].parse({ 'CONFIRM_LINK': confirm_link }); + + // Email confirmation code + var expiry_time = 60*60*2, // Expire after 2 hours + email_key = 'email:' + email + ':confirm', + confirm_key = 'confirm:' + confirm_code + ':email'; + + RDB.set(email_key, confirm_code); + RDB.expire(email_key, expiry_time); + RDB.set(confirm_key, email); + RDB.expire(confirm_key, expiry_time); + + // Send intro email w/ confirm code + var message = emailjs.message.create({ + text: confirm_email_plaintext, + from: config.mailer.from, + to: email, + subject: '[NodeBB] Registration Email Verification', + attachment: [ + { + data: confirm_email, + alternative: true + } + ] + }); + + emailjsServer.send(message, function(err, success) { + if (err) + console.log(err); + }); + } } User.addFriend = function(uid, friendid, callback) { diff --git a/src/webserver.js b/src/webserver.js index 4f3a25f606..1b468c6476 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -85,7 +85,10 @@ var express = require('express'), return; } - res.send(templates['header'] + app.create_route(route) + templates['footer']); + res.send( + templates['header'].parse({ cssSrc: global.config['theme:src'] || '/vendor/bootstrap/css/bootstrap.min.css' }) + + app.create_route(route) + templates['footer'] + ); }); }(routes[i])); }