diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json index 93c0fef2e1..65d3f51ceb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json @@ -4,7 +4,7 @@ "debuggingEnabled": false, "permissionRoot": "/", "portalURL": "https://${server.ip}:9445", - "loginPage": "cdmf.page.sign-in", + "loginPage": "cdmf.page.sign-in.login-do", "adminServicesUrl": "https://${server.ip}:${server.https_port}/admin/services/", "authModule": { "enabled": true, @@ -15,12 +15,12 @@ }, "onFail": { "script": "/app/modules/login.js", - "page": "cdmf.page.sign-in" + "page": "cdmf.page.sign-in.login-do" } }, "logout": { "onSuccess": { - "page": "cdmf.page.sign-in" + "page": "cdmf.page.sign-in.login-do" }, "onFail": { "page": "cdmf.page.dashboard" diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs new file mode 100644 index 0000000000..c1d0e4140d --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.hbs @@ -0,0 +1,73 @@ +{{! + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + WSO2 Inc. licenses this file to you under the Apache License, + Version 2.0 (the "License"); you may not use this file except + in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +}} +{{#zone "title"}}{{! to override parent page title }}{{/zone}} +{{unit "cdmf.unit.ui.title" pageTitle="Consent Page"}} + +{{#zone "content"}} +
+
+ +

User Consents

+
+
+ {{appName}} application requests access to your profile information +
+ +
+
+

By selecting following attributes I agree to share them with the above service provider.

+
+ +
+
+ {{#each mandatoryClaims}} + + {{/each}} +
+
+ {{#each requestedClaims}} + + {{/each}} +
+

Mandatory claims are marked with an asterisk ( * )

+
+ + + + +
+
+
+
+
+{{/zone}} +{{#zone "bottomJs"}} + {{js "js/script.js"}} +{{/zone}} \ 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.consent-do/consent-do.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js new file mode 100644 index 0000000000..e15908617e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.js @@ -0,0 +1,38 @@ +function onRequest(context) { + var Encode = Packages.org.owasp.encoder.Encode; + var viewModel = {}; + viewModel.appName = Encode.forHtml(request.getParameter("sp")); + var mandatoryClaims = []; + var requestedClaims = []; + + var mandatoryClaimsList, requestedClaimsList; + var i, j, partOne, partTwo; + if (request.getParameter("mandatoryClaims")) { + mandatoryClaimsList = request.getParameter("mandatoryClaims").split(","); + for (j = 0; j < mandatoryClaimsList.length; j++) { + var mandatoryClaimsStr = mandatoryClaimsList[j]; + i = mandatoryClaimsStr.indexOf('_'); + partOne = mandatoryClaimsStr.slice(0, i); + partTwo = mandatoryClaimsStr.slice(i + 1, mandatoryClaimsStr.length); + mandatoryClaims.push( + {"claimId": Encode.forHtmlAttribute(partOne), "displayName": Encode.forHtmlAttribute(partTwo)} + ); + } + } + if (request.getParameter("requestedClaims")) { + requestedClaimsList = request.getParameter("requestedClaims").split(","); + for (j = 0; j < requestedClaimsList.length; j++) { + var requestedClaimsStr = requestedClaimsList[j]; + i = requestedClaimsStr.indexOf('_'); + partOne = requestedClaimsStr.slice(0, i); + partTwo = requestedClaimsStr.slice(i + 1, requestedClaimsStr.length); + requestedClaims.push( + {"claimId": Encode.forHtmlAttribute(partOne), "displayName": Encode.forHtmlAttribute(partTwo)} + ); + } + } + viewModel.mandatoryClaims = mandatoryClaims; + viewModel.requestedClaims = requestedClaims; + viewModel.sessionDataKey = Encode.forHtmlAttribute(request.getParameter("sessionDataKey")); + 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.consent-do/consent-do.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.json new file mode 100644 index 0000000000..4ca8fc3a6c --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/consent-do.json @@ -0,0 +1,6 @@ +{ + "version": "1.0.0", + "layout": "uuf.layout.sign-in", + "uri": "/consent.do", + "isAnonymous": true +} \ 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.consent-do/public/js/script.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js new file mode 100644 index 0000000000..8588c004a9 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.consent-do/public/js/script.js @@ -0,0 +1,35 @@ +function approved() { + var mandatoryClaimCBs = $(".mandatory-claim"); + var checkedMandatoryClaimCBs = $(".mandatory-claim:checked"); + + if (checkedMandatoryClaimCBs.length == mandatoryClaimCBs.length) { + document.getElementById('consent').value = "approve"; + document.getElementById("consentForm").submit(); + } else { + $("#modal_claim_validation").modal(); + } +} + +function deny() { + document.getElementById('consent').value = "deny"; + document.getElementById("consentForm").submit(); +} + +$(document).ready(function () { + $("#consent_select_all").click(function () { + if (this.checked) { + $('.checkbox input:checkbox').each(function () { + $(this).prop("checked", true); + }); + } else { + $('.checkbox :checkbox').each(function () { + $(this).prop("checked", false); + }); + } + }); + $(".checkbox input").click(function (e) { + if (e.target.id !== 'consent_select_all') { + $("#consent_select_all").prop("checked", false); + } + }); +}); \ 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.login-do/login-do.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.hbs new file mode 100644 index 0000000000..ab496ea12c --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.hbs @@ -0,0 +1,71 @@ +{{! + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + WSO2 Inc. licenses this file to you under the Apache License, + Version 2.0 (the "License"); you may not use this file except + in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +}} +{{#zone "title"}}{{! to override parent page title }}{{/zone}} +{{unit "cdmf.unit.ui.title" pageTitle="Login"}} + +{{#zone "content"}} +
+
+ +

Login

+
+ {{#if message}} +
+ {{message}}! +
+ {{/if}} + +
+
+
+ + +
+
+ + +
+ {{#if sessionDataKey}} + + {{/if}} + {{#if referer}} + + {{/if}} + +
+
+ +
+ + +
+
+
+
+
+{{/zone}} \ 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.login-do/login-do.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.js new file mode 100644 index 0000000000..627791eebb --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.js @@ -0,0 +1,32 @@ +function onRequest(context) { + var authModuleConfigs = context.app.conf["authModule"]; + var sessionDataKey = request.getParameter("sessionDataKey"); + var authFailure = request.getParameter("authFailure"); + + //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 = "/commonauth"; + } + + if (authFailure) { + viewModel.message = "Login failed! Please recheck the username and password and try again."; + } + + 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.login-do/login-do.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.json new file mode 100644 index 0000000000..467bcc522b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.login-do/login-do.json @@ -0,0 +1,6 @@ +{ + "version": "1.0.0", + "layout": "uuf.layout.sign-in", + "uri": "/login.do", + "isAnonymous": true +} \ 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.retry-do/retry-do.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.hbs new file mode 100644 index 0000000000..48f9562995 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.hbs @@ -0,0 +1,32 @@ +{{! + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + WSO2 Inc. licenses this file to you under the Apache License, + Version 2.0 (the "License"); you may not use this file except + in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +}} +{{#zone "title"}}{{! to override parent page title }}{{/zone}} +{{unit "cdmf.unit.ui.title" pageTitle="Authentication Failed!"}} + +{{#zone "content"}} +
+
+ +

{{stat}}

+
+
+ {{statusMessage}} +
+
+
+{{/zone}} \ 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.retry-do/retry-do.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.js new file mode 100644 index 0000000000..cdd7a4be93 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.js @@ -0,0 +1,17 @@ +function onRequest(context) { + var Encode = Packages.org.owasp.encoder.Encode; + session.invalidate(); + var viewModel = {}; + + var stat = request.getParameter("status"); + var statusMessage = request.getParameter("statusMsg"); + + if (!stat || !statusMessage) { + stat = "Authentication Error!"; + statusMessage = "Something went wrong during the authentication process.Please try signing in again."; + } + + viewModel.stat = Encode.forHtmlContent(stat); + viewModel.statusMessage = Encode.forHtmlContent(statusMessage); + 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.retry-do/retry-do.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.json new file mode 100644 index 0000000000..b66acf55c9 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in.retry-do/retry-do.json @@ -0,0 +1,6 @@ +{ + "version": "1.0.0", + "layout": "uuf.layout.sign-in", + "uri": "/retry.do", + "isAnonymous": true +} \ 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.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 bd000a752d..104579406b 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 @@ -19,53 +19,5 @@ {{unit "cdmf.unit.ui.title" pageTitle="Login"}} {{#zone "content"}} -
-
- -

Login

-
- {{#if message}} -
- {{message}}! -
- {{/if}} - -
-
-
- - -
-
- - -
- {{#if sessionDataKey}} - - {{/if}} - {{#if referer}} - - {{/if}} - -
-
- -
- - -
-
-
-
-
+ Redirecting, Please wait... {{/zone}} 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 index 627791eebb..1f33330c28 100644 --- 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 @@ -1,32 +1,3 @@ function onRequest(context) { - var authModuleConfigs = context.app.conf["authModule"]; - var sessionDataKey = request.getParameter("sessionDataKey"); - var authFailure = request.getParameter("authFailure"); - - //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 = "/commonauth"; - } - - if (authFailure) { - viewModel.message = "Login failed! Please recheck the username and password and try again."; - } - - viewModel.sessionDataKey = sessionDataKey; - viewModel.loginActionUrl = loginActionUrl; - return viewModel; + response.sendRedirect(context.app.context + "/uuf/login"); } \ No newline at end of file