Solved

implementing Remember Me feature for UserName and password on Lotus Domino

Posted on 2008-10-16
9
1,288 Views
Last Modified: 2013-12-18
Hi,

How can I implement "Remember Me" functionality for web application which uses the Domino authentication.

Any help is appreciated.

Regards
0
Comment
Question by:ashishanand
  • 3
  • 3
  • 2
9 Comments
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 500 total points
ID: 22729826
0
 

Author Comment

by:ashishanand
ID: 22730361
I've had a look at it but it does not help.
Need more specific approach or example

Thanks
0
 
LVL 5

Expert Comment

by:gratex_ssd
ID: 22805477
do you mean single sign on feature? the main purpose is to enter your name and password only once. if you have computer in domain, and you have the same password and name for your windows account and also for your lotus notes client (lot people have), then it is automatically used (it is necessary to have installed lotus SSO service on that PC).  or you mean automatic web authentification. This can be done via Apache Tomcat authentification. http://tomcat.apache.org/ The process is, that when you open web link, e.g. http://server:8080/database.nsf, then you will be silently redirected to tomcat (which check and compare your windows login, with your lotus notes login, if ok, then this will be recorded in his DB), and if authentification succed, you may proceed. if not, then password synchronization is necessary (sometime you need to delete that synchro data for some users. that data poining on person record, and if that person record changed, it will not work. this is also a solution for non working sametime client)

is this what you are looking for?
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 5

Expert Comment

by:gratex_ssd
ID: 22805484
in here is few more infos about Apache Tomcat SSO and some nice attached tutorials - http://www.360doc.com/showWeb/0/0/22640.aspx
0
 

Author Comment

by:ashishanand
ID: 23876129
I've implemented Remember Me feature in Domino using Javascript Cookies (Please refer to the code below and the attached code snippet).

I've created a custom login form. Apart from User Name and Password fields on the form, I've created a CheckBox field "Remember Me" inside a Layer.
<DIV id='RememberMeLayer'><INPUT TYPE="checkbox" NAME="RememberMe" Value="Yes">Remember Me</DIV>


OnSubmit the system checks if "Remember Me" is checked". If yes, the the cookies are set.
<form onsubmit="doSubmit();" method="post" action="/names.nsf?Login" name="_LoginForm">


The following code is put into the form's "HTML Body Attribute" object, this is to check the Remember Me cookie.
"onload=\"findObj('UserName').focus(); initCookie();\""


Hope someone can find it useful.
Please let me know if you have any issues.
function initCookie()
{
	var cookieName = 'UserNamePWD';
	var cookieValue = GetCookie(cookieName);
	if (cookieValue  != null) {
		namePwdArray = cookieValue.split('~');
		var usrName = namePwdArray[0];
		var pwd = namePwdArray[1];
	}
	if (usrName != 'Anonymous' && usrName != '' && usrName != null && pwd != '' && pwd != null) {
		findObj('UserName').value = usrName;
		findObj('Password').value = pwd;
	
		if (findObj("RememberMe") != null)
			setItemValue(findObj("RememberMe"), "Yes")
		showHideLayers('RememberMeLayer', '', 'hide')
	}
}
 
 
function doRememberMe() {
 
	var thenewdate = new Date ();
	var cookieName = 'UserNamePWD';
 
	usrName = findObj('UserName').value;
	pwd = findObj('Password').value;
	if (usrName != 'Anonymous' && usrName != '' && usrName != null && pwd != null) {
		thenewdate.setTime(thenewdate.getTime() + (365 * 24 * 3600 * 1000));
		SetCookie(cookieName, usrName + '~' + pwd, thenewdate);
	}
}
 
 
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
 
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal (j);
 
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return null;
}
 
 
 
 
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
 
	return unescape(document.cookie.substring(offset, endstr));
}
 
 
 
 
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
 
	document.cookie =	name + "=" + escape (value) +
			((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
			((path == null) ? "" : ("; path=" + path)) +
			((domain == null) ? "" : ("; domain=" + domain)) +
			((secure == true) ? "; secure" : "");
}
 
 
 
 
 
function DeleteCookie(name) {
	var exp = new Date();
	var cval = GetCookie (name);
 
	FixCookieDate (exp); 
	exp.setTime (exp.getTime() - 1); 
 
	if (cval != null)
		document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
 
 
 
function FixCookieDate (date) {
	var base = new Date(0);
	var skew = base.getTime(); // dawn of (Unix) time - should be 0
	if (skew > 0)  // Except on the Mac - ahead of its time
		date.setTime (date.getTime() - skew);
}
 
 
 
function findObj(n, d) 
{
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
 
 
function showHideLayers() 
{
 var i,p,v,obj,args=showHideLayers.arguments;
 for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
   if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
   obj.visibility=v; }
}
 
 
function setItemValue(itemObject, itemValue)
{
	var itemObj = null;
	if ( itemObject.type )
		itemObj = itemObject;
	else
		itemObj = itemObject[0];
 
	var value = itemValue;
	value = value.replace(/#039/g,"'");
	value = value.replace(/#034/g,"\"");
	value = value.replace(/#999/g,"@^");
 
	if (itemObj.type.toLowerCase() == "text" || itemObj.type.toLowerCase() == "hidden"  || itemObj.type.toLowerCase() == "textarea")
	{
		itemObj.value = itemValue;
		return;	
	}
	if (itemObj.type.toLowerCase() == "checkbox" )
		setCheckBox(itemObject, itemValue);
	if (itemObj.type.toLowerCase() == "select-one" || itemObj.type.toLowerCase() == "select-multi")
		selectListBoxValue(itemObj , itemValue);
	if (itemObj.type.toLowerCase() == "radio")
		setRadioItemChecked(itemObj , itemValue);
}
 
 
function setCheckBox(obj, value)
{
	var valueArray = value.split(",");
	if(obj.length != null)
	{
		for(var i = 0; i < obj.length; i++)
		{
			if( inArray(obj[i].value, valueArray))
				obj[i].checked = true;
			else
				obj[i].checked = false;
		}
	}
	else
		if( inArray(obj.value, valueArray) )
			obj.checked = true;
		else
			obj.checked = false;
}
 
 
 
function selectListBoxValue(item, itemValue)
{
	for ( i=0; i < item.options.length ; i++)
	{
		if ( item.options[i].value == itemValue )
		{
			item.options.selectedIndex = i;
			return;
		}
	}
 
}
 
 
function setRadioItemChecked(item, itemValue)
{
	var radioItem = findObj( item.name );
 
	for ( i= 0; i < radioItem.length; i++)
	{
		if ( radioItem[i].value == itemValue )
		{
			radioItem[i].checked = true;
			return;
		}
		else
		{
			radioItem[i].checked = false;
		}
	}
}

Open in new window

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 23877351
It might be useful to someone else indeed!

And be my guest, accept your own answer. I hope the first method given in the link I posted put you on the right track.
0
 

Accepted Solution

by:
ashishanand earned 0 total points
ID: 23877496
With all due respect sjef_bosman, I do agree your posting was of help.

I choose to accept my own answer because it is actually the solution, and if anyone else comes across this posting I would want the person to be guided to the complete solution.

With reference to the points, is it possible to accept my solution as the correct solution and still award the points to someone who guided towards it?

Please advice.
Regards
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 23877719
No problem. It's just that I have lots of other things to do and hence no time to develop a complete solution for you. :-)

As far as I know, it is possible to accept your own solution and award points to others. How? Dunno, it should be in the page somewhere, and certainly on the EE Help page.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question