From b10c3235821162e56926aae0189292dbd8ebcc69 Mon Sep 17 00:00:00 2001 From: Megala Date: Sun, 2 Oct 2016 21:26:13 +0530 Subject: [PATCH] Fixing the problem in login --- .../resources/jaggeryapps/devicemgt/app/modules/login.js | 8 +++++--- .../jaggeryapps/uuf-template-app/lib/constants.js | 2 +- .../jaggeryapps/uuf-template-app/lib/modules/auth/auth.js | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js index 001188f0e6..d36e7af0ab 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/login.js @@ -26,14 +26,16 @@ var onFail; var utility = require("/app/modules/utility.js").utility; var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; if (context.input.samlToken) { - apiWrapperUtil.setupTokenPairBySamlGrantType(context.user.username, context.input.samlToken); + apiWrapperUtil.setupTokenPairBySamlGrantType(context.user.username + '@' + context.user.domain, context.input.samlToken); } else { apiWrapperUtil.setupTokenPairByPasswordGrantType(context.input.username, context.input.password); } var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var carbonServer = require("carbon").server; - (new carbonServer.Server({url: devicemgtProps["adminService"]})) - .login(context.input.username, context.input.password); + if (!context.input.samlToken) { + (new carbonServer.Server({url: devicemgtProps["adminService"]})) + .login(context.input.username, context.input.password); + } }; onFail = function (error) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js index f7806238b6..8a4e0677f1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/constants.js @@ -105,7 +105,7 @@ var constants = { CACHE_KEY_APP_CONF_FILE_LMD: "_UUF_APP_CONF_FILE_LMD", CACHE_KEY_LOOKUP_TABLE: "_UUF_LOOKUP_TABLE", CACHE_KEY_USER: "_UUF_USER", - CACHE_KEY_SSO_SESSIONS: "_UUF_SSO_SESSIONS", + CACHE_KEY_SSO_SESSIONS: "sso_sessions", CACHE_KEY_HANDLEBARS_ROOT: "_UUF_HANDLEBARS_ROOT", // URL Query Params URL_PARAM_REFERER: "referer" diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js index 9f009cb6cf..e9bc8e8ca4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js @@ -364,10 +364,10 @@ var module = {}; * samlToken: string}>} SSO sessions */ function getSsoSessions() { - var ssoSessions = application.get('sso_sessions'); + var ssoSessions = application.get(constants.CACHE_KEY_SSO_SESSIONS); if (!ssoSessions) { ssoSessions = {}; - application.put('sso_sessions', ssoSessions); + application.put(constants.CACHE_KEY_SSO_SESSIONS, ssoSessions); } return ssoSessions; }