Node.js based forum software built for the modern web
implemented emailer for welcome email (though the email confirmation system is horribly broken)
Julian Lam339ed4e47bb0
diff --git a/public/templates/emails/welcome.hbs b/public/templates/emails/welcome.hbsindex efe1f039fe..0043548aee 100644--- a/public/templates/emails/welcome.hbs+++ b/public/templates/emails/welcome.hbs@@ -1,19 +1,15 @@<p>Hello {{username}},</p>-<p><strong>Thank you for registering with {{site_title}}!</strong></p>-<p>To fully activate your account, we need to verify that you own the email address you registered with. Please click on the following link:</p>-<blockquote>{{confirm_link}}</blockquote>-<p>Thanks!<br /><strong>{{site_title}}</strong>diff --git a/src/emailer.js b/src/emailer.jsindex a52fa75c94..1d7d479db3 100644--- a/src/emailer.js+++ b/src/emailer.js@@ -59,8 +59,8 @@ Emailer.send = function(template, uid, params) {if (!err) {Plugins.fireHook('action:email.send', {to: email,- from: Meta.config['email:from'],- subject: subject,+ from: Meta.config['email:from'] || '[email protected]',+ subject: params.subject,html: results.html,plaintext: results.plaintext});diff --git a/src/routes/debug.js b/src/routes/debug.jsindex c97cc14b2d..6bbd06ce9d 100644--- a/src/routes/debug.js+++ b/src/routes/debug.js@@ -81,8 +81,9 @@ var DebugRoute = function(app) {app.get('/test', function(req, res) {var Emailer = require('../emailer');- Emailer.send('welcome', {+ Emailer.send('welcome', 1, {username: 'test',+ subject: 'this is a subject',site_title: 'derp',confirm_link: 'linkylink'});diff --git a/src/user.js b/src/user.jsindex 6ab5c47c96..33af2557a5 100644--- a/src/user.js+++ b/src/user.js@@ -15,7 +15,7 @@ var bcrypt = require('bcrypt'),notifications = require('./notifications'),topics = require('./topics'),events = require('./events'),-+ Emailer = require('./emailer'),websockets = require('./websockets');(function(User) {@@ -103,7 +103,7 @@ var bcrypt = require('bcrypt'),if (email !== undefined) {db.setObjectField('email:uid', email, uid);- User.sendConfirmationEmail(email);+ User.sendConfirmationEmail(uid, email);}plugins.fireHook('action:user.create', {uid: uid, username: username, email: email, picture: gravatar, timestamp: timestamp});@@ -823,15 +823,9 @@ var bcrypt = require('bcrypt'),}};- User.sendConfirmationEmail = function(email) {+ User.sendConfirmationEmail = function(uid, email) {var confirm_code = utils.generateUUID(),- confirm_link = nconf.get('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- })*/;+ confirm_link = nconf.get('url') + 'confirm/' + confirm_code;// Email confirmation codevar expiry_time = Date.now() / 1000 + 60 * 60 * 2;