diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs index 105c65ac6d..a7f39044dc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs @@ -31,7 +31,7 @@ {{/if}}
-
+
+ {{#if sessionDataKey}} + + {{/if}} {{#if referer}} {{/if}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js new file mode 100644 index 0000000000..df49bf1d04 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js @@ -0,0 +1,28 @@ +function onRequest(context) { + var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var authModuleConfigs = context.app.conf["authModule"]; + var sessionDataKey = request.getParameter("sessionDataKey"); + + //if sso enabled and sessionDataKey is empty redirect + var ssoConfigs = authModuleConfigs["sso"]; + if (ssoConfigs && (ssoConfigs["enabled"].toString() == "true") && !sessionDataKey) { + // SSO is enabled in Auth module. + var redirectUri = context.app.context + "/uuf/login"; + var queryString = request.getQueryString(); + if (queryString && (queryString.length > 0)) { + redirectUri = redirectUri + "?" + queryString; + } + response.sendRedirect(encodeURI(redirectUri)); + exit(); + } + + var viewModel = {}; + var loginActionUrl = context.app.context + "/uuf/login"; + if (sessionDataKey) { + loginActionUrl = devicemgtProps["httpsURL"] + "/commonauth"; + } + + viewModel.sessionDataKey = sessionDataKey; + viewModel.loginActionUrl = loginActionUrl; + return viewModel; +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json index 58846893fc..91d4a819bd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json @@ -1,5 +1,6 @@ { "version": "1.0.0", + "layout": "uuf.layout.sign-in", "uri": "/login", - "extends": "uuf.page.sign-in" + "isAnonymous": true } \ No newline at end of file