Fix username extraction in another two places. Thanks @demimismo.

Closes #100 (again)
This commit is contained in:
Sandro Santilli 2014-01-09 15:36:16 +01:00
parent 36159a7697
commit fcd17692ee

View File

@ -188,7 +188,7 @@ module.exports = function(){
}
var dbName = req.params.dbname;
var username = req.headers.host.split('.')[0];
var username = this.userByReq(req);
// strip out windshaft/mapnik inserted sql if present
var sql = req.params.sql.match(/^\((.*)\)\sas\scdbq$/);
@ -577,7 +577,7 @@ console.log("Checking authorization from signer " + signer + " for resource " +
if ( tksplit.length > 1 ) req.params.cache_buster= tksplit[1];
tksplit = req.params.token.split('@');
if ( tksplit.length > 1 ) {
req.params.signer = req.headers.host.split('.')[0];
req.params.signer = this.userByReq(req);
if ( tksplit[0] ) req.params.signer = tksplit[0];
req.params.token = tksplit[1];
//console.log("Request for token " + req.params.token + " with signature from " + req.params.signer);