Merge pull request #864 from rasika/master

Fixing Log-in api call per every page load.
4.x.x
Kamidu Sachith Punchihewa 7 years ago committed by GitHub
commit f3a926b91c

@ -50,11 +50,10 @@ function onRequest(context) {
var BILLING_INFO_RETRY_COUNT_KEY = 'BILLING_INFO_RETRY_COUNT_' + context.user.domain; var BILLING_INFO_RETRY_COUNT_KEY = 'BILLING_INFO_RETRY_COUNT_' + context.user.domain;
if (viewModal.Main.Account.billingEnabled) { if (viewModal.Main.Account.billingEnabled) {
var cookie = getLoginCookie();
if (!session.get(BILLING_INFO_KEY) || daysAfterLastCheck(session.get(BILLING_INFO_KEY).lastChecked) > 1) { if (!session.get(BILLING_INFO_KEY) || daysAfterLastCheck(session.get(BILLING_INFO_KEY).lastChecked) > 1) {
session.put(BILLING_INFO_RETRY_COUNT_KEY, 0); session.put(BILLING_INFO_RETRY_COUNT_KEY, 0);
var serviceUrl = viewModal.Main.Account.cloudMgtHost + "/cloudmgt/site/blocks/admin/admin.jag"; 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); var billingInfo = session.get(BILLING_INFO_KEY);
@ -65,7 +64,7 @@ function onRequest(context) {
var cloudMgtIndexPage = viewModal.Main.Account.cloudMgtIndexPage; var cloudMgtIndexPage = viewModal.Main.Account.cloudMgtIndexPage;
if (!billingInfo) { if (!billingInfo) {
recordFirstLogin(serviceUrl, cookie, 1); recordFirstLogin(serviceUrl, getLoginCookie(), 1);
log.info("Access denied for tenant: " + context.user.domain log.info("Access denied for tenant: " + context.user.domain
+ " with a NULL subscription. Redirected to CloudMgt"); + " with a NULL subscription. Redirected to CloudMgt");
response.sendRedirect(cloudMgtIndexPage); response.sendRedirect(cloudMgtIndexPage);

Loading…
Cancel
Save