Set preferences on login page

This tip describes how to configure your system to allow preferences to be set on the 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

Dig deeper on Domino Resources - Part 4

0 comments

Oldest 

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:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close