Call userByReq() only once in req2params

This commit is contained in:
Sandro Santilli 2014-02-27 16:40:59 +01:00
parent f24e4f8a0a
commit 55f333c0b7

View File

@ -707,6 +707,8 @@ module.exports = function(){
_.each(bad_query, function(key){ delete req.query[key]; });
req.params = _.extend({}, req.params); // shuffle things as request is a strange array/object
var user = me.userByReq(req);
if ( req.params.token ) {
//console.log("Request parameters include token " + req.params.token);
var tksplit = req.params.token.split(':');
@ -715,7 +717,7 @@ module.exports = function(){
tksplit = req.params.token.split('@');
if ( tksplit.length > 1 ) {
req.params.signer = tksplit.shift();
if ( ! req.params.signer ) req.params.signer = this.userByReq(req);
if ( ! req.params.signer ) req.params.signer = user;
if ( tksplit.length > 1 ) {
var template_hash = tksplit.shift(); // unused
}
@ -734,8 +736,6 @@ module.exports = function(){
if (req.profiler) req.profiler.done('req2params.setup');
var user = me.userByReq(req);
Step(
function getPrivacy(){
me.authorize(req, this);