mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-08 00:22:51 +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>
|
||||
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'
|
||||
});
|
||||
|
||||
14
src/user.js
14
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 code
|
||||
var expiry_time = Date.now() / 1000 + 60 * 60 * 2;
|
||||
|
||||
Reference in New Issue
Block a user