Hi,
Does anyone know if it is possible to cache the Users logon name when they sign in to the IVE using the web-browser or via the Network Connect program ? We have a number of users asking if there is anyway they can avoid having to enter their username each time, and let it remember it (via a cookie or something) - so that they just have to type in their SecurID password.
Thanks, Tim.
how did you do that? Any chance we could see a snippet of code from your page for the non-html geeks like me? My users complain about this all the time.
Thanks,
Justin
Justin -
We do something like it as well. We use an IVE as a portal to distribute traffic to IVEs around the world based on the location of a user's mail server. We store the cookie on this page, and read it on the logon page of the server to which the user is redirected.
Here is the function which sets the cookie -
function displayFocus()
{
var elem=document.getElementById('promptname').value;
if (elem=="")
{ elem="1";}
cookie1="SSO="+elem+"; expires=Mon, 31 Dec 2015 23:59:59 UTC ; path=/; domain=.mydomain.com";
document.cookie=cookie1;
var elem2=elem+"@SSLVPN";
var pass="SSLVPN";
var elem3=document.getElementById('promptname');
var pass2=document.getElementById('password');
elem3.setAttribute('value',elem2);
pass2.setAttribute('value',pass);
var returnpar="return Login(<% setcookies %>)";
return returnpar;
The displayfocus function is called via the onsubmit parameter of the form. Here is what the form looks like, including where we read the cookie if it exists already -
<form id=login name=frmLogin action=login.cgi method="POST" autocomplete=off onsubmit="displayFocus()">
<input type="hidden" name="tz_offset">
<FIELDSET>
<%IF !AnonymousAuthentication && !CertificateAuthentication && !SAMLAuthentication%>
<% FOREACH prompt = prompts %>
<% NEXT IF !prompt.required %>
<% IF prompt.promptText == "username" %>
<LABEL class=username for=username>User ID</LABEL>
<script language="javascript">
sso="";
ca = document.cookie.split(';');
for(var i=0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
if (c.indexOf("SSO=") == 0) sso = c.substring(4, c.length); }
if (sso.length == 0)
//document.write('<td><input type=text name=username id="promptname" size="6"></td>');
document.write('<INPUT class=ge_mc_textbox name=username id="promptname">');
else {
s = sso.indexOf("@SSLVPN");
if (s > 0) sso = sso.substring(0, s);
document.write('<INPUT class=ge_mc_textbox name=username id="promptname" value=' + sso +'>'); }
</script>
<% ELSIF prompt.promptText == "password" %>
<INPUT class=ge_mc_textbox id="password" type="hidden" name="<%prompt.name%>">
<% ELSE %>
<input type="hidden" name="<%prompt.name%>" size="22">
<% END %>
<% END %>
<% IF RealmList.size == 0 %>
<% realm %> <input type="text" name="realm" value="" size="20">
<% ELSIF RealmList.size == 1 %>
<input type="hidden" name="realm" value="<% RealmList.0 %>">
<% ELSE %>
<% realm %> <select size="1" name="realm">
<% FOREACH r = RealmList %>
<option value="<% r %>" ><% r %></option>
<% END %>
</select>
<% END %>
<%ELSE%>
<input type="hidden" name="realm" value="<% RealmList.0 %>">
<%END%>
</FIELDSET>
Hope this is helpful.
Ken
We just call a function before the login form is submitted. Then inside that function we get the username and the save it to a cookie.
********** LoginPage.thml snippet ************* <!-- Call customLogin() before submitting the form --> <form id="frmLogin" name="frmLogin" method="post" action="login.cgi" onsubmit="return customLogin();"> ******** customLogin() snippet ************* // Get the username from the form and save it to a cookie // You need to define the setCookie function var username = document.forms['frmLogin'].username.value; setCookie('cookie-name', username, '9999', '', '', '');
When the user returns to the login page, then you have to check the cookie for a saved username and populate the username field in the form.
You may want to do some more input validation to make sure the username is the correct format and length.********** LoginPage.thml snippet **********
<!-- Place this towards the bottom of the page. It needs to be called after the login form loads -->
<script type="text/javascript">
initialize();
</script>********** initialize() snippet ************ // Get the saved username and put it into the username field // You will have to define the getCookie function var savedUsername = getCookie("cookie-name"); if(savedUsername == null) savedUsername = ""; document.forms['frmLogin'].username.value = savedUsername;
drf -
Do you still use this in the recent version 6.4 or 6.5?
Can you upload the whole code of the login page, I'm not able to reproduce what you have done?
Thanks in advance
Olivier.