HOTFIX: Profiles are visible when logged out
This commit is contained in:
+10
-22
@@ -75,29 +75,17 @@ function profileRequestInner(connection, req, res, body) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//validate the credentials
|
//results.length === 1
|
||||||
let query = 'SELECT COUNT(*) AS total FROM sessions WHERE accountId = ? AND token = ?;';
|
res.status(200).json({
|
||||||
connection.query(query, [body.id, body.token], (err, credentials) => {
|
username: body.username,
|
||||||
if (err) throw err;
|
gold: results[0].gold,
|
||||||
|
recruits: results[0].recruits,
|
||||||
if (credentials[0].total !== 1) {
|
soldiers: results[0].soldiers,
|
||||||
res.status(400).write(log('Invalid profile request credentials', JSON.stringify(body), body.id, body.token));
|
spies: results[0].spies,
|
||||||
res.end();
|
scientists: results[0].scientists
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//results.length === 1
|
|
||||||
res.status(200).json({
|
|
||||||
username: body.username,
|
|
||||||
gold: results[0].gold,
|
|
||||||
recruits: results[0].recruits,
|
|
||||||
soldiers: results[0].soldiers,
|
|
||||||
spies: results[0].spies,
|
|
||||||
scientists: results[0].scientists
|
|
||||||
});
|
|
||||||
res.end();
|
|
||||||
log('Profile sent', body.username, body.id, body.token);
|
|
||||||
});
|
});
|
||||||
|
res.end();
|
||||||
|
log('Profile sent', body.username, body.id, body.token);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user