Merge pull request #2199 from isocolsky/fixed_headers

Read headers in lowercase
This commit is contained in:
Matias Alejo Garcia 2014-12-18 20:21:41 -03:00
commit a5aaee9abe
1 changed files with 13 additions and 5 deletions

View File

@ -70,16 +70,24 @@ angular.module('copayApp.services')
if (!headers)
return;
if (headers['X-Email-Needs-Validation'])
var customHeaders = {};
_.each(_.keys(headers), function (headerKey) {
var hk = headerKey.toLowerCase();
if (hk.indexOf('x-') === 0) {
customHeaders[hk] = headers[headerKey];
}
});
if (customHeaders['x-email-needs-validation'])
$rootScope.needsEmailConfirmation = true;
else
$rootScope.needsEmailConfirmation = null;
if (headers['X-Quota-Per-Item'])
$rootScope.quotaPerItem = parseInt(headers['X-Quota-Per-Item']);
if (customHeaders['x-quota-per-item'])
$rootScope.quotaPerItem = parseInt(customHeaders['x-quota-per-item']);
if (headers['X-Quota-Items-Limit'])
$rootScope.quotaItems = parseInt(headers['X-Quota-Items-Limit']);
if (customHeaders['x-quota-items-limit'])
$rootScope.quotaItems = parseInt(customHeaders['x-quota-items-limit']);
};
root.open = function(email, password, cb) {