Tip

Set preferences on login page

I had just built a simple configuration page where an incoming mail-user could select between the ordinary green webmail and iNotes and switch over to secure traffic with SSL. The main function was that all users only should learn one URL instead of the full address to his or her mailfile so my form took care of that as well. Nothing fancy, nothing hard. Not even nice profile documents, the user should select this every time he or she logs in because of different connection-speed, public access and so on.

But select and login at the same page? Domino handles login (when session based authentication is enabled) in a database called domcfg.nsf. There is a form that you can change, $$LoginUserForm. This database has some interesting features. When a user enters an URL that leads to a database where anonymous has no access, the domino server displays the login form. The server takes the username and password and tries to find a person document in the domino directory. If the username and password are accepted the users is forwarded to the database. The address is not changed in the users browser in this process.

The problem How can I find the users mailfile before I know who he is? How can I pass the parameters?

My solution There is a field on the $$LoginUserForm called RedirectTo that holds the URL entered by the user. This is the key to my solution. I use a JavaScript function, see below, to capture the users selected options and then creates a URL with some parameters and writes the calculated URL to the RedirectTo field. The URL leads to my original configuration-database. In this database I capture the parameters, finds out who the user is and where the mailfile is located (could be on a different server) and creates a new URL and use the http"<meta http-equiv="refresh" content=0;URL=" + url + ">" entered in the HTML-Head Content to re-direct directly to the users mailfile with all the parameters, i.e. http/https and &ui=inotes/webmail.

If you do this, think of a way out for the user. In the above scenario every user that logs in is automatically re-directed to his/hers mailbox. Perhaps a user wants to access another database? My solution was to check what URL the user entered, is it a predefined address, like webmail.server.com, then the new URL is created and if it is another URL, like server.com/anotherdatabase.nsf, then domcfg.nsf should work as normal. You can always hide the extra options if the user is heading to another database to avoid confusion.

This is part of the code I have in JS header and the function is called in the onSubmit event.


function createUrl() {
 var doc = document.forms[0];
 var url = location.href.toLowerCase() ;
 var pos = url.indexOf("://");
 url = url.substr(pos+3, url.length);
 
 //Checks to see if our mailURL is entered and sets some standard values
 
 if ( url == "webmail.server.com/") {
  var valdui = "webmail";   
  var protokoll = "http://";
  var krypterat = "no";
  
  //Picks the users choises from the form
  //ui iNotes or webmail
  ui = doc.fldUI;
  langd = ui.length;
  for (i=0; i<langd; i++){
       if (ui[i].checked) {
        valdui = ui[i].value;
       }
  }

  //SSL or not
  ssl = doc.fldSSL;
  if (ssl.checked){
   protokoll = "https://";
   krypterat = "yes";
  }
  //Builds the URL to the form that does the logic. 
  var url = protokoll + url + "mailspark.nsf/frmmailspark?openform&" + krypterat + "~" + valdui;
  }
  
  //The user entered another URL
  else {
    var url = location.href;
  }

  doc.RedirectTo.value = url;

}

This was first published in July 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.