[imp] changing login page

Tim Akinbo takinbo at yahoo.com
Thu Jan 9 12:22:30 PST 2003


Hi Rob,

I had a similar problem and I was able to solve the problem by
modifying the imp login template. I had to insert some javascript that
would check the username box if @mydomain.com was present in the
username (just in case the user actually types in the @mydomain.com).
If it finds it, then the form is submitted else it would append
@mydomain.com and submit the form.

In the /horde/imp/templates/login/login.inc you would have to modify
the submit_login function. Here's a sample:

function submit_login()
{
<?php if ($conf['server']['server_list'] == 'shown'): ?>
  if (document.implogin.server
document.implogin.server.selectedIndex].value.substr(0, 1) == "_") {
        return false;
  }
<?php endif; ?>
    if (document.implogin.imapuser.value == "") {
        alert('<?= addslashes(_("Please provide your username and
password")) ?>');
        document.implogin.imapuser.focus();
        return false;
    } else if (document.implogin.pass.value == "") {
        alert('<?= addslashes(_("Please provide your username and
password")) ?>');
        document.implogin.pass.focus();
        return false;
    } else {
        <?php 
	  // Obtain the domain name.
	  preg_match("/[^\.]*\.(.*)/i", $_SERVER['HTTP_HOST'], $matches);
	  $domain = $matches[1]; 
	?>
        domain = "<?= $domain ?>";
        
	// Escape all instances of a dot
	domain = domain.replace("\.", "\\.");
        if (!(document.implogin.imapuser.value.match("%" + domain +
"$"))) {
                document.implogin.imapuser.value =
document.implogin.imapuser.value.concat("%<?= $domain ?>");
        }
        return true;
    }
}

-------------
Tim

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


More information about the imp mailing list