mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
implemented emailer for welcome email (though the email confirmation system is horribly broken)
This commit is contained in:
@@ -1,19 +1,15 @@
|
|||||||
<p>
|
<p>
|
||||||
Hello {{username}},
|
Hello {{username}},
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>Thank you for registering with {{site_title}}!</strong>
|
<strong>Thank you for registering with {{site_title}}!</strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<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:
|
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>
|
</p>
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
{{confirm_link}}
|
{{confirm_link}}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Thanks!<br />
|
Thanks!<br />
|
||||||
<strong>{{site_title}}</strong>
|
<strong>{{site_title}}</strong>
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ Emailer.send = function(template, uid, params) {
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
Plugins.fireHook('action:email.send', {
|
Plugins.fireHook('action:email.send', {
|
||||||
to: email,
|
to: email,
|
||||||
from: Meta.config['email:from'],
|
from: Meta.config['email:from'] || 'no-reply@localhost.lan',
|
||||||
subject: subject,
|
subject: params.subject,
|
||||||
html: results.html,
|
html: results.html,
|
||||||
plaintext: results.plaintext
|
plaintext: results.plaintext
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -81,8 +81,9 @@ var DebugRoute = function(app) {
|
|||||||
|
|
||||||
app.get('/test', function(req, res) {
|
app.get('/test', function(req, res) {
|
||||||
var Emailer = require('../emailer');
|
var Emailer = require('../emailer');
|
||||||
Emailer.send('welcome', {
|
Emailer.send('welcome', 1, {
|
||||||
username: 'test',
|
username: 'test',
|
||||||
|
subject: 'this is a subject',
|
||||||
site_title: 'derp',
|
site_title: 'derp',
|
||||||
confirm_link: 'linkylink'
|
confirm_link: 'linkylink'
|
||||||
});
|
});
|
||||||
|
|||||||
14
src/user.js
14
src/user.js
@@ -15,7 +15,7 @@ var bcrypt = require('bcrypt'),
|
|||||||
notifications = require('./notifications'),
|
notifications = require('./notifications'),
|
||||||
topics = require('./topics'),
|
topics = require('./topics'),
|
||||||
events = require('./events'),
|
events = require('./events'),
|
||||||
|
Emailer = require('./emailer'),
|
||||||
websockets = require('./websockets');
|
websockets = require('./websockets');
|
||||||
|
|
||||||
(function(User) {
|
(function(User) {
|
||||||
@@ -103,7 +103,7 @@ var bcrypt = require('bcrypt'),
|
|||||||
|
|
||||||
if (email !== undefined) {
|
if (email !== undefined) {
|
||||||
db.setObjectField('email:uid', email, uid);
|
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});
|
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(),
|
var confirm_code = utils.generateUUID(),
|
||||||
confirm_link = nconf.get('url') + 'confirm/' + confirm_code/*,
|
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
|
|
||||||
})*/;
|
|
||||||
|
|
||||||
// Email confirmation code
|
// Email confirmation code
|
||||||
var expiry_time = Date.now() / 1000 + 60 * 60 * 2;
|
var expiry_time = Date.now() / 1000 + 60 * 60 * 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user