diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs index a3af675cae..7a958ed83f 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/pages/mdm.page.enrollments.windows.invoke-agent/invoke-agent.hbs @@ -18,7 +18,7 @@ under the License. --}} {{#zone "accessControl"}} {{ unit "mdm.unit.enrollments.access-control" - allowedPlatform = "Windows Phone" + allowedPlatform = ["Windows Phone", "Windows"] currentPage = "invoke-agent" nextPage = "login-agent" }} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/units/mdm.unit.enrollments.access-control/access-control.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/units/mdm.unit.enrollments.access-control/access-control.js index 58d161f3ea..a6927b2980 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/units/mdm.unit.enrollments.access-control/access-control.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/units/mdm.unit.enrollments.access-control/access-control.js @@ -29,11 +29,7 @@ function onRequest(context) { parser.getResult(); var userAgentPlatform = parser.getOS()["name"]; - if (userAgentPlatform != context.unit.params["allowedPlatform"]) { - // if userAgentPlatform is not allowed - log.error("platform not allowed"); - response.sendRedirect(context.app.context + "/enrollments/error/unintentional-request"); - } else { + if (context.unit.params["allowedPlatform"].indexOf(userAgentPlatform) !== -1) { var lastPage = context.unit.params["lastPage"]; var nextPage = context.unit.params["nextPage"]; var currentPage = context.unit.params["currentPage"]; @@ -44,9 +40,7 @@ function onRequest(context) { if (!session.get("lastAccessedPage")) { // meaning a middle page is accessed at first response.sendRedirect(context.app.context + "/enrollments/error/unintentional-request"); - } else if (!(session.get("lastAccessedPage") == currentPage) && - !(session.get("lastAccessedPage") == lastPage) && - !(session.get("lastAccessedPage") == nextPage)) { + } else if (!(session.get("lastAccessedPage") == currentPage) && !(session.get("lastAccessedPage") == lastPage) && !(session.get("lastAccessedPage") == nextPage)) { response.sendRedirect(context.app.context + "/enrollments/error/unintentional-request"); } else if (currentPage) { // if currentPage is set, update lastAccessedPage as currentPage @@ -57,8 +51,7 @@ function onRequest(context) { if (!session.get("lastAccessedPage")) { // this means the last page is accessed at first response.sendRedirect(context.app.context + "/enrollments/error/unintentional-request"); - } else if (!(session.get("lastAccessedPage") == currentPage) && - !(session.get("lastAccessedPage") == lastPage)) { + } else if (!(session.get("lastAccessedPage") == currentPage) && !(session.get("lastAccessedPage") == lastPage)) { response.sendRedirect(context.app.context + "/enrollments/error/unintentional-request"); } else if (currentPage) { // if currentPage is set, update lastAccessedPage as currentPage @@ -69,11 +62,15 @@ function onRequest(context) { // if currentPage is set, update lastAccessedPage as currentPage session.put("lastAccessedPage", currentPage); } + } else { + // if userAgentPlatform is not allowed + log.error("platform not allowed"); + response.sendRedirect(context.app.context + "/enrollments/error/unintentional-request"); } if (log.isDebugEnabled()) { log.debug("last-accessed-page = " + session.get("lastAccessedPage") + - " : " + "session-id = " + session.getId()); + " : " + "session-id = " + session.getId()); } return context; } \ No newline at end of file