fixing jira issue IOTS-368

revert-dabc3590
Hasunie 8 years ago
parent 8bd06c60f2
commit e186ef6bb3

@ -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"
}}

@ -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;
}
Loading…
Cancel
Save