Fixing Log-in api call per every page load.

revert-70aa11f8
Rasika Perera 7 years ago
parent b7d28754c6
commit 669ffcdb94

@ -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);

Loading…
Cancel
Save