implemented emailer for welcome email (though the email confirmation system is horribly broken)

v1.18.x
Julian Lam 11 years ago
parent 5a527de287
commit 339ed4e47b

@ -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>

@ -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'] || 'no-reply@localhost.lan',
subject: params.subject,
html: results.html,
plaintext: results.plaintext
});

@ -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'
});

@ -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 code
var expiry_time = Date.now() / 1000 + 60 * 60 * 2;

Loading…
Cancel
Save