mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fix crash on follow/edit
This commit is contained in:
@@ -23,10 +23,14 @@ var fs = require('fs'),
|
|||||||
|
|
||||||
function getUserDataByUserSlug(userslug, callerUID, callback) {
|
function getUserDataByUserSlug(userslug, callerUID, callback) {
|
||||||
user.getUidByUserslug(userslug, function(err, uid) {
|
user.getUidByUserslug(userslug, function(err, uid) {
|
||||||
if (err || !uid) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!uid) {
|
||||||
|
return callback(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
async.parallel({
|
async.parallel({
|
||||||
userData : function(next) {
|
userData : function(next) {
|
||||||
user.getUserData(uid, next);
|
user.getUserData(uid, next);
|
||||||
@@ -347,7 +351,7 @@ accountsController.getBaseUser = function(userslug, callerUID, callback) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
accountsController.accountEdit = function(req, res, next) {
|
accountsController.accountEdit = function(req, res, callback) {
|
||||||
var userData;
|
var userData;
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
@@ -355,11 +359,14 @@ accountsController.accountEdit = function(req, res, next) {
|
|||||||
},
|
},
|
||||||
function(data, next) {
|
function(data, next) {
|
||||||
userData = data;
|
userData = data;
|
||||||
|
if (!userData) {
|
||||||
|
return callback();
|
||||||
|
}
|
||||||
db.getObjectField('user:' + userData.uid, 'password', next);
|
db.getObjectField('user:' + userData.uid, 'password', next);
|
||||||
}
|
}
|
||||||
], function(err, password) {
|
], function(err, password) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
userData.hasPassword = !!password;
|
userData.hasPassword = !!password;
|
||||||
|
|||||||
Reference in New Issue
Block a user