|
|
|
@ -5,12 +5,13 @@ var async = require('async'),
|
|
|
|
|
nconf = require('nconf'),
|
|
|
|
|
winston = require('winston'),
|
|
|
|
|
|
|
|
|
|
user = require('./../user'),
|
|
|
|
|
utils = require('./../../public/src/utils'),
|
|
|
|
|
plugins = require('./../plugins'),
|
|
|
|
|
db = require('./../database'),
|
|
|
|
|
meta = require('./../meta'),
|
|
|
|
|
emailer = require('./../emailer');
|
|
|
|
|
user = require('../user'),
|
|
|
|
|
utils = require('../../public/src/utils'),
|
|
|
|
|
translator = require('../../public/src/translator'),
|
|
|
|
|
plugins = require('../plugins'),
|
|
|
|
|
db = require('../database'),
|
|
|
|
|
meta = require('../meta'),
|
|
|
|
|
emailer = require('../emailer');
|
|
|
|
|
|
|
|
|
|
(function(UserEmail) {
|
|
|
|
|
|
|
|
|
@ -42,27 +43,30 @@ var async = require('async'),
|
|
|
|
|
db.expireAt('confirm:' + confirm_code, Math.floor(Date.now() / 1000 + 60 * 60 * 2), next);
|
|
|
|
|
}
|
|
|
|
|
], function(err) {
|
|
|
|
|
|
|
|
|
|
user.getUserField(uid, 'username', function(err, username) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return winston.error(err.message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = {
|
|
|
|
|
site_title: (meta.config.title || 'NodeBB'),
|
|
|
|
|
username: username,
|
|
|
|
|
confirm_link: confirm_link,
|
|
|
|
|
confirm_code: confirm_code,
|
|
|
|
|
translator.translate('[[email:welcome-to, ' + (meta.config.title || 'NodeBB') + ']]', meta.config.defaultLang, function(subject) {
|
|
|
|
|
var data = {
|
|
|
|
|
site_title: (meta.config.title || 'NodeBB'),
|
|
|
|
|
username: username,
|
|
|
|
|
confirm_link: confirm_link,
|
|
|
|
|
confirm_code: confirm_code,
|
|
|
|
|
|
|
|
|
|
subject: 'Welcome to ' + (meta.config.title || 'NodeBB') + '!',
|
|
|
|
|
template: 'welcome',
|
|
|
|
|
uid: uid
|
|
|
|
|
};
|
|
|
|
|
subject: subject,
|
|
|
|
|
template: 'welcome',
|
|
|
|
|
uid: uid
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (plugins.hasListeners('action:user.verify')) {
|
|
|
|
|
plugins.fireHook('action:user.verify', uid, data);
|
|
|
|
|
} else if (plugins.hasListeners('action:email.send')) {
|
|
|
|
|
emailer.send('welcome', uid, data);
|
|
|
|
|
}
|
|
|
|
|
if (plugins.hasListeners('action:user.verify')) {
|
|
|
|
|
plugins.fireHook('action:user.verify', uid, data);
|
|
|
|
|
} else if (plugins.hasListeners('action:email.send')) {
|
|
|
|
|
emailer.send('welcome', uid, data);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|