From ef6083b682d0ad6758a894df2f9c47777718523f Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 18 Dec 2014 20:11:55 -0300 Subject: [PATCH] read headers in lowercase --- js/services/identityService.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/js/services/identityService.js b/js/services/identityService.js index 2f226ff8a..426fa641f 100644 --- a/js/services/identityService.js +++ b/js/services/identityService.js @@ -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) {