v1.18.x
barisusakli 11 years ago
parent 3e73e17502
commit 1296cd58b9

@ -0,0 +1,4 @@
{
"password-reset-requested": "Password Reset Requested - %1!",
"welcome-to": "Welcome to %1"
}

@ -164,6 +164,10 @@ var socket,
}
app.cacheBuster = config['cache-buster'];
bootbox.setDefaults({
locale: config.defaultLang
});
}
}
@ -570,4 +574,5 @@ var socket,
app.loadConfig();
app.alternatingTitle('');
}());

@ -4,8 +4,7 @@ define('forum/reset', function() {
ResetPassword.init = function() {
var inputEl = $('#email'),
errorEl = $('#error'),
successEl = $('#success'),
errorTextEl = errorEl.find('p');
successEl = $('#success');
$('#reset').on('click', function() {
if (inputEl.val() && inputEl.val().indexOf('@') !== -1) {
@ -16,13 +15,11 @@ define('forum/reset', function() {
errorEl.addClass('hide').hide();
successEl.removeClass('hide').show();
successEl.find('p').html('An email has been dispatched to "' + inputEl.val() + '" with instructions on setting a new password.');
inputEl.val('');
});
} else {
successEl.addClass('hide').hide();
errorEl.removeClass('hide').show();
errorTextEl.html('Please enter a valid email');
}
});
};

@ -225,8 +225,6 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
uploads.toggleThumbEls(postContainer, composer.posts[post_uuid].topic_thumb || '');
}
postContainer.on('change', 'input, textarea', function() {
composer.posts[post_uuid].modified = true;
});

@ -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,18 +43,20 @@ 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);
}
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') + '!',
subject: subject,
template: 'welcome',
uid: uid
};
@ -66,6 +69,7 @@ var async = require('async'),
});
});
});
});
};
UserEmail.confirm = function(code, callback) {

@ -4,13 +4,15 @@
var async = require('async'),
nconf = require('nconf'),
user = require('./../user'),
utils = require('./../../public/src/utils'),
user = require('../user'),
utils = require('../../public/src/utils'),
translator = require('../../public/src/translator'),
db = require('./../database'),
meta = require('./../meta'),
events = require('./../events'),
emailer = require('./../emailer');
db = require('../database'),
meta = require('../meta'),
events = require('../events'),
emailer = require('../emailer'),
tran;
(function(UserReset) {
@ -39,28 +41,27 @@ var async = require('async'),
UserReset.send = function(socket, email, callback) {
user.getUidByEmail(email, function(err, uid) {
if(err || !uid) {
if (err || !uid) {
return callback(err || new Error('[[error:invalid-email]]'));
}
// Generate a new reset code
var reset_code = utils.generateUUID();
db.setObjectField('reset:uid', reset_code, uid);
db.setObjectField('reset:expiry', reset_code, (60 * 60) + Math.floor(Date.now() / 1000));
var reset_link = nconf.get('url') + '/reset/' + reset_code;
translator.translate('[[email:password-reset-requested, ' + (meta.config.title || 'NodeBB') + ']]', meta.config.defaultLang, function(subject) {
emailer.send('reset', uid, {
site_title: (meta.config.title || 'NodeBB'),
reset_link: reset_link,
subject: 'Password Reset Requested - ' + (meta.config.title || 'NodeBB') + '!',
subject: subject,
template: 'reset',
uid: uid
});
callback();
});
});
};
UserReset.commit = function(socket, code, password, callback) {

Loading…
Cancel
Save