mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-07 14:42:10 +02:00
Merge branch 'master' of github.com:designcreateplay/NodeBB
This commit is contained in:
@@ -28,10 +28,16 @@ define(function() {
|
||||
app.previousUrl = '/';
|
||||
}
|
||||
|
||||
if(app.previousUrl.indexOf('/reset/') != -1)
|
||||
if(app.previousUrl.indexOf('/reset/') !== -1) {
|
||||
window.location.replace(RELATIVE_PATH + "/?loggedin");
|
||||
else
|
||||
window.location.replace(app.previousUrl + "?loggedin");
|
||||
} else {
|
||||
var index = app.previousUrl.indexOf('#');
|
||||
if(index !== -1) {
|
||||
window.location.replace(app.previousUrl.slice(0, index) + '?loggedin' + app.previousUrl.slice(index));
|
||||
} else {
|
||||
window.location.replace(app.previousUrl + "?loggedin");
|
||||
}
|
||||
}
|
||||
|
||||
app.loadConfig();
|
||||
}
|
||||
|
||||
58
src/user.js
58
src/user.js
@@ -108,39 +108,43 @@ var bcrypt = require('bcryptjs'),
|
||||
'showemail': 0
|
||||
};
|
||||
|
||||
db.setObject('user:' + uid, userData);
|
||||
db.setObject('user:' + uid, userData, function(err) {
|
||||
|
||||
db.setObjectField('username:uid', userData.username, uid);
|
||||
db.setObjectField('userslug:uid', userData.userslug, uid);
|
||||
|
||||
if (userData.email !== undefined) {
|
||||
db.setObjectField('email:uid', userData.email, uid);
|
||||
if (parseInt(uid, 10) !== 1) {
|
||||
User.email.verify(uid, userData.email);
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
db.setObjectField('username:uid', userData.username, uid);
|
||||
db.setObjectField('userslug:uid', userData.userslug, uid);
|
||||
|
||||
plugins.fireHook('action:user.create', userData);
|
||||
db.incrObjectField('global', 'userCount');
|
||||
|
||||
db.sortedSetAdd('users:joindate', timestamp, uid);
|
||||
db.sortedSetAdd('users:postcount', 0, uid);
|
||||
db.sortedSetAdd('users:reputation', 0, uid);
|
||||
|
||||
groups.joinByGroupName('registered-users', uid);
|
||||
|
||||
if (password) {
|
||||
User.hashPassword(password, function(err, hash) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
if (userData.email !== undefined) {
|
||||
db.setObjectField('email:uid', userData.email, uid);
|
||||
if (parseInt(uid, 10) !== 1) {
|
||||
User.email.verify(uid, userData.email);
|
||||
}
|
||||
}
|
||||
|
||||
User.setUserField(uid, 'password', hash);
|
||||
plugins.fireHook('action:user.create', userData);
|
||||
db.incrObjectField('global', 'userCount');
|
||||
|
||||
db.sortedSetAdd('users:joindate', timestamp, uid);
|
||||
db.sortedSetAdd('users:postcount', 0, uid);
|
||||
db.sortedSetAdd('users:reputation', 0, uid);
|
||||
|
||||
groups.joinByGroupName('registered-users', uid);
|
||||
|
||||
if (password) {
|
||||
User.hashPassword(password, function(err, hash) {
|
||||
if(err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
User.setUserField(uid, 'password', hash);
|
||||
callback(null, uid);
|
||||
});
|
||||
} else {
|
||||
callback(null, uid);
|
||||
});
|
||||
} else {
|
||||
callback(null, uid);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user