|
|
|
@ -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,6 +62,10 @@ 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()) {
|
|
|
|
|