The code has names.nsf hardcoded as the database to authenticate against.
If you replace this code
<xp:scriptBlock id="scr_Login">
<xp:this.value><![CDATA[function login(data){
dojo.xhrPost({
url: '/names.nsf?login',
handleAs : "text",
content: {
with this code
<xp:scriptBlock id="scr_Login">
<xp:this.value><![CDATA[function login(data){
dojo.xhrPost({
url: window.location.href.split('.nsf')[0] + '.nsf?Login',
handleAs : "text",
content: {
the login can be used where users do not have access to names.nsf which is the case in many of our applications
Sean