Merge pull request #368 from amalhub/master

Fixing issue: EMM-1537
revert-70aa11f8
Dilan U. Ariyaratne 8 years ago committed by GitHub
commit 2d7506d9b8

@ -51,7 +51,12 @@ if (uriMatcher.match("/{context}/api/operation/paginate")) {
} else {
response["status"] = restAPIResponse["status"];
if (restAPIResponse["responseText"]) {
response["content"] = parse(restAPIResponse["responseText"]);
var responseText = "";
try {
response["content"] = parse(restAPIResponse["responseText"]);
} catch (e) {
responseText = restAPIResponse["responseText"];
}
}
}
}

@ -45,12 +45,13 @@ var invokers = function () {
* If the token pair is not set in the session, this will return null.
*/
privateMethods.getAccessToken = function () {
var tokenPair = session.get(constants["TOKEN_PAIR"]);
if (tokenPair) {
return parse(tokenPair)["accessToken"];
} else {
return null;
if (session) {
var tokenPair = session.get(constants["TOKEN_PAIR"]);
if (tokenPair) {
return parse(tokenPair)["accessToken"];
}
}
return null;
};
/**
@ -80,7 +81,7 @@ var invokers = function () {
if (devicemgtProps["isOAuthEnabled"]) {
var accessToken = privateMethods.getAccessToken();
if (!accessToken) {
if (accessToken == null) {
userModule.logout(function () {
response.sendRedirect(devicemgtProps["appContext"] + "login");
});

Loading…
Cancel
Save