some fixes

v1.18.x
Baris Usakli 12 years ago
parent 3100bfcfd3
commit 433c7d91eb

@ -217,6 +217,7 @@ var user = require('./../user.js'),
function api_method(req, res) { function api_method(req, res) {
var callerUID = req.user ? req.user.uid : 0; var callerUID = req.user ? req.user.uid : 0;
console.log(req.user);
var userslug = req.params.userslug; var userslug = req.params.userslug;
var section = req.params.section ? String(req.params.section).toLowerCase() : null; var section = req.params.section ? String(req.params.section).toLowerCase() : null;
@ -297,7 +298,7 @@ var user = require('./../user.js'),
res.json(404, { error: 'User not found!' }) ; res.json(404, { error: 'User not found!' }) ;
return; return;
} }
uid = parseInt(uid, 10);
if(uid !== callerUid || callerUid === "0") { if(uid !== callerUid || callerUid === "0") {
res.json(403, { error: 'Not allowed!' }); res.json(403, { error: 'Not allowed!' });
return; return;
@ -357,12 +358,10 @@ var user = require('./../user.js'),
user.get_uid_by_userslug(userslug, function(uid) { user.get_uid_by_userslug(userslug, function(uid) {
if(uid === null) { if(uid === null) {
callback(null); callback(null)
return; return;
} }
uid = parseInt(uid, 10);
user.getUserData(uid, function(data) { user.getUserData(uid, function(data) {
if(data) { if(data) {
data.joindate = utils.relativeTime(data.joindate); data.joindate = utils.relativeTime(data.joindate);

Loading…
Cancel
Save