I'm working on a plugin for ICN and I've managed to have it log in automatically retrieving the username/password from a file by an id which is passed as a parameter in the url. Once a user has logged in there will be no need to relog, however after some time the 'session expiration' will kick in and even after reloading I can't get it to log in again. This might be due to the fact that I'm basing my decision on a single javascript object: ecm.model.desktop.connected.
Right now if ecm.model.desktop.connected is false it will try to log in, this works well until the session expiration, which apparently does not set the ecm.model.desktop.connected to false, it's still set to true. So I'm hoping to learn a way to tell if the session has expired.
This here is my login code:
if (ecm.model.desktop.connected == false || ecm.model.desktop.userId != loginConfig[loginID].username) {
var http2 = new XMLHttpRequest();
var url2 = "/navigator/logon.do";
var params2 = "userid=" + loginConfig[loginID].username + "&password=" + loginConfig[loginID].password;
http2.open("POST", url2, false);
http2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http2.onreadystatechange = function() {//Call a function when the state changes.
if (http2.readyState == 4 && http2.status == 200) {
}
};
http2.send(params2);
window.location.reload();
}