Commit bb6e23bc authored by Steve Johnson's avatar Steve Johnson

Added checkbox UseIDP in login settings

parent cebad539
......@@ -93,7 +93,7 @@
</div>
<div class="hidden" data-role="fieldcontain" data-theme='a' id="resetpanel" style='font-family: verdana; font-size: 14px;'>
<a data-role='button' id='logoutButton' style='width: 60%; margin: auto; text-align: center;' onclick='clickLogoutButton(); return false;'href='#'>IDP Logout</a>
<a data-role='button' id='logoutButton' style='width: 60%; margin: auto; text-align: center;' onclick='clickLogoutButton(); return false;'href='#'>Logout</a>
</div>
<br><br>
......
......@@ -3,7 +3,7 @@
var remoteUri = "mse/remote/remote.html";
var remoteUriIdp = "mse/php/auth/idp_login.php";
var qparams = "";
// This is the uri baked into the application that redirects to the selected location.
var routingUri = "/"+remoteUri;
......@@ -140,7 +140,7 @@
if (page && page == 'true') {
// Use this if we upgrade to version 1.9 or higher
//$('#cbUseIDP').prop('checked', true).checkboxradio('refresh');
//$("#cbUseIDP").attr("checked", "checked").checkboxradio("refresh");
$("#cbUseIDP").attr("checked", "checked").checkboxradio("refresh");
// jquery is broken. Do it manually
$('.ui-icon').removeClass('ui-icon-checkbox-off ui-checkbox-off').addClass('ui-icon-checkbox-on ui-checkbox-on');
......@@ -149,7 +149,7 @@
else {
// Use this if we upgrade to version 1.9 or higher
//$('#cbUseIDP').prop('checked', false).checkboxradio('refresh');
//$("#cbUseIDP").removeAttr("checked").checkboxradio("refresh");
$("#cbUseIDP").removeAttr("checked").checkboxradio("refresh");
// jquery is broken. Do it manually
$('#cbLabel').removeClass('ui-checkbox-on').addClass('ui-checkbox-off');
}
......@@ -157,6 +157,8 @@
}
else {
$('#cbLabel').addClass('hidden');
$("#cbUseIDP").removeAttr("checked").checkboxradio("refresh");
$('#cbLabel').removeClass('ui-checkbox-on').addClass('ui-checkbox-off');
}
}
}
......
......@@ -44,7 +44,6 @@ var Remote = (function () {
var wsUrl;
var selectedApp = null;
// Note: deviceList contains an array of structures, one for each device. The device structures
// will have different attributes depending on whether standalone (javascript discovery), OS X mse client,
// or native iOS app.
......@@ -91,6 +90,20 @@ var Remote = (function () {
remote.onLoad = function() {
var qp = queryParams();
if (qp.reset != undefined) {
//dojo.cookie(K.cookieAuthorized, "deleted", {expires: -1, path: '/'});
deleteAllCookies();
var search = window.location.search;
search = search.replace("?reset&","?");
search = search.replace("?reset","");
search = search.replace("&reset","");
location.replace(location.pathname+search);
}
// Pre-check for not logged in and using external IDP.
var cookie = dojo.cookie(K.cookieAuthorized);
if (!cookie || cookie == 'deleted') {
......@@ -115,8 +128,6 @@ var Remote = (function () {
console.log("onLoad: "+window.location);
var qp = queryParams();
if (qp.ios != undefined) {
iosNative = true;
}
......@@ -201,10 +212,6 @@ var Remote = (function () {
var qp = queryParams();
if (qp.reset != undefined) {
dojo.cookie(K.cookieAuthorized, "deleted", {expires: -1, path: '/'});
}
if (qp.standalone != undefined) {
// Using javascript/web discovery.(dial.js module)
......@@ -1267,6 +1274,24 @@ var Remote = (function () {
return cookies;
}
// Only works on root cookies
function deleteAllCookies() {
// Nameless cookie
document.cookie = "" + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT;path=/;';
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
var cookieRecord = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;";
document.cookie = cookieRecord;
console.log("Deleted Cookie: \n"+name);
}
}
remote.loginSettings = function() {
console.log("loginSettings - location: "+redirectUri);
var redirectUri = location.href;
......@@ -1277,7 +1302,7 @@ var Remote = (function () {
}
remote.logoutIDP = function() {
document.cookie = "MSE_Authorized" + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
document.cookie = "MSE_Authorized" + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;';
var uri = Url.idpLogout()+window.location.search;
window.location.replace(uri);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment