moved hasPassword to edit route

its only used there no need to display it everywhere user info is
retrieved
v1.18.x
barisusakli 11 years ago
parent d4f47f4157
commit 0eb4b93882

@ -8,6 +8,7 @@ var fs = require('fs'),
nconf = require('nconf'),
async= require('async'),
db = require('../database'),
user = require('../user'),
posts = require('../posts'),
topics = require('../topics'),
@ -340,12 +341,21 @@ function getBaseUser(userslug, callerUID, callback) {
accountsController.accountEdit = function(req, res, next) {
var callerUID = req.user ? parseInt(req.user.uid, 10) : 0;
getUserDataByUserSlug(req.params.userslug, callerUID, function (err, userData) {
if(err) {
var userData;
async.waterfall([
function(next) {
getUserDataByUserSlug(req.params.userslug, callerUID, next);
},
function(data, next) {
userData = data;
db.getObjectField('user:' + userData.uid, 'password', next);
}
], function(err, password) {
if (err) {
return next(err);
}
userData.hasPassword = !!password;
userData.csrf = req.csrfToken();
res.render('account/edit', userData);

@ -103,7 +103,6 @@ var async = require('async'),
return;
}
user.hasPassword = !!user.password;
if (user.password) {
user.password = null;
}

Loading…
Cancel
Save