Auto-log on axes session in web view element
Posted: Sat Jul 14, 2012 8:33 am
How can I have an axes session automatically log on when being displayed in a Web View element on a Form View?
I have created this scenario and have the axes session displaying fine. I have used code Luis provided on the axes forum a couple weeks ago to handle the automatic log on process (that code is included below), and I have used code from a "Directing 5250 Screen Access" tutorial to automatically navigate me to a particular screen after the log on has completed. If launch Safari on my iPad and enter my URL everything works perfectly including the automatic log-on and the automatic navigation to my screen.
When I use the same URL in the Web View element in LongRange the axes session is displayed, but the automatic log on function does not work. If I manually enter my user ID and password and log on, the automatic navigation kicks in and successfully navigates me to my screen. The automatic log on is the only thing that does not work the same. What do I have to do differently to make the automatic log on process work from within LongRange?
Here is the automatic log on code I am using:
Set the onApplicationStart event property to:
if (AXES.isTS2Engine == true)
{
USERENV.DoAutoSignOn = true
AXES.Terminal.addListener("ScreenArrivedPreRender", USERENV.handleScreenArrivedPreRender, USERENV);
}
Set the onApplicationEnd event property to:
if (AXES.isTS2Engine == true)
{
AXES.Terminal.removeListener("ScreenArrivedPreRender", USERENV.handleScreenArrivedPreRender);
}
handleScreenArrivedPreRender : function(event)
{
var showScreen = false
if (AXES.currentForm.isLogin == true)
{
if (USERENV.DoAutoSignOn == true)
{
//If we get in here it means the user has just connected, so we need to auto connect.
//We will make sure that the next time this function executes (likely when the user signs off), we do not auto connect.
USERENV.DoAutoSignOn = false;
//We haven't added any error handling. You may want to add some if there is the possibility of an invalid or disabled profile.
AXES.currentForm.getFieldByName("loginUser").setValue("xxxxxx");
AXES.currentForm.getFieldByName("loginPwd").setValue("xxxxxx");
AXES.currentForm.postAIDKey("Enter")
//The return false hides the form
return showScreen;
}
else
{
//If we get in here, it is because the user has signed off. If you want to display the signon screen to the user here, set showScreen to true.
//The return false hides the form
return showScreen;
}
}
}, /* <--- Note the comma */
I have created this scenario and have the axes session displaying fine. I have used code Luis provided on the axes forum a couple weeks ago to handle the automatic log on process (that code is included below), and I have used code from a "Directing 5250 Screen Access" tutorial to automatically navigate me to a particular screen after the log on has completed. If launch Safari on my iPad and enter my URL everything works perfectly including the automatic log-on and the automatic navigation to my screen.
When I use the same URL in the Web View element in LongRange the axes session is displayed, but the automatic log on function does not work. If I manually enter my user ID and password and log on, the automatic navigation kicks in and successfully navigates me to my screen. The automatic log on is the only thing that does not work the same. What do I have to do differently to make the automatic log on process work from within LongRange?
Here is the automatic log on code I am using:
Set the onApplicationStart event property to:
if (AXES.isTS2Engine == true)
{
USERENV.DoAutoSignOn = true
AXES.Terminal.addListener("ScreenArrivedPreRender", USERENV.handleScreenArrivedPreRender, USERENV);
}
Set the onApplicationEnd event property to:
if (AXES.isTS2Engine == true)
{
AXES.Terminal.removeListener("ScreenArrivedPreRender", USERENV.handleScreenArrivedPreRender);
}
handleScreenArrivedPreRender : function(event)
{
var showScreen = false
if (AXES.currentForm.isLogin == true)
{
if (USERENV.DoAutoSignOn == true)
{
//If we get in here it means the user has just connected, so we need to auto connect.
//We will make sure that the next time this function executes (likely when the user signs off), we do not auto connect.
USERENV.DoAutoSignOn = false;
//We haven't added any error handling. You may want to add some if there is the possibility of an invalid or disabled profile.
AXES.currentForm.getFieldByName("loginUser").setValue("xxxxxx");
AXES.currentForm.getFieldByName("loginPwd").setValue("xxxxxx");
AXES.currentForm.postAIDKey("Enter")
//The return false hides the form
return showScreen;
}
else
{
//If we get in here, it is because the user has signed off. If you want to display the signon screen to the user here, set showScreen to true.
//The return false hides the form
return showScreen;
}
}
}, /* <--- Note the comma */