v1.18.x
barisusakli 11 years ago
parent c8084e9b2e
commit c4b083330c

@ -12,14 +12,14 @@ var async = require('async'),
module.exports = function(User) { module.exports = function(User) {
User.create = function(userData, callback) { User.create = function(data, callback) {
var gravatar = User.createGravatarURLFromEmail(userData.email); var gravatar = User.createGravatarURLFromEmail(data.email);
var timestamp = Date.now(); var timestamp = Date.now();
var password = userData.password; var password = data.password;
userData = { var userData = {
'username': userData.username.trim(), 'username': data.username.trim(),
'email': userData.email, 'email': data.email,
'joindate': timestamp, 'joindate': timestamp,
'picture': gravatar, 'picture': gravatar,
'gravatarpicture': gravatar, 'gravatarpicture': gravatar,
@ -103,7 +103,7 @@ module.exports = function(User) {
} }
}, },
customFields: function(next) { customFields: function(next) {
plugins.fireHook('filter:user.custom_fields', userData, next); plugins.fireHook('filter:user.custom_fields', [], next);
}, },
userData: function(next) { userData: function(next) {
plugins.fireHook('filter:user.create', userData, next); plugins.fireHook('filter:user.create', userData, next);
@ -113,7 +113,14 @@ module.exports = function(User) {
return callback(err); return callback(err);
} }
userData = utils.merge(results.userData, results.customFields); var customData = {};
results.customFields.forEach(function(customField) {
if (data[customField]) {
customData[customField] = data[customField];
}
});
userData = utils.merge(results.userData, customData);
var userNameChanged = !!results.renamedUsername; var userNameChanged = !!results.renamedUsername;

Loading…
Cancel
Save