From 669ffcdb94c5d1f8b8ed4b506abcc678961a4291 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 25 Jul 2017 10:55:31 +0530 Subject: [PATCH] Fixing Log-in api call per every page load. --- .../units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js index cec47088a8e..b31ccca7c41 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js @@ -50,11 +50,10 @@ function onRequest(context) { var BILLING_INFO_RETRY_COUNT_KEY = 'BILLING_INFO_RETRY_COUNT_' + context.user.domain; if (viewModal.Main.Account.billingEnabled) { - var cookie = getLoginCookie(); if (!session.get(BILLING_INFO_KEY) || daysAfterLastCheck(session.get(BILLING_INFO_KEY).lastChecked) > 1) { session.put(BILLING_INFO_RETRY_COUNT_KEY, 0); var serviceUrl = viewModal.Main.Account.cloudMgtHost + "/cloudmgt/site/blocks/admin/admin.jag"; - getBillingData(serviceUrl, cookie, 1); + getBillingData(serviceUrl, getLoginCookie(), 1); } var billingInfo = session.get(BILLING_INFO_KEY); @@ -65,7 +64,7 @@ function onRequest(context) { var cloudMgtIndexPage = viewModal.Main.Account.cloudMgtIndexPage; if (!billingInfo) { - recordFirstLogin(serviceUrl, cookie, 1); + recordFirstLogin(serviceUrl, getLoginCookie(), 1); log.info("Access denied for tenant: " + context.user.domain + " with a NULL subscription. Redirected to CloudMgt"); response.sendRedirect(cloudMgtIndexPage);