Page 1 of 1

HOWTO: Log on SquirrelMail using only username (no domain)

Posted: 2004-10-15 21:47
by SiC_Goat
1) navigate to drive:\path\to\squirrelmail\src
2) Locate redirect.php
3) Open it with wordpad (dreamweaver if you've got it)
4) Do a find on

Code: Select all

/* Verify that username and password are correct. */
That should be over something that looks like this

Code: Select all

    if ($force_username_lowercase) {
        $login_username = strtolower($login_username);
    }
Below the } add this

Code: Select all

$at = array("@"); 
foreach ($at as $val) { 
 if (stristr(trim($login_username),$val)) { 
  $domains += 1;
 } 
} 
if($domains < 1){
 $login_username .= "@yourdomain.net";
}
This will check to see if the user had the @domain.net in his username, if he did it will do nothing, but if he didn't, it will add the @domain.net to the end of it before checking / loggin in.

I took the freedom to edit this post a bit and moving it to howto's / Martin

Posted: 2005-07-19 03:56
by FAWTS
Another solution is using the login_alias plugin. That can help a lot if there is several domains and users feel happy to be able to change the login, use accents or special caracters...

Posted: 2005-07-27 21:51
by fsdfdg
there is a slight issue with this modification...

this turns up on the apache logs:

[client 128.195.95.163] PHP Notice: Undefined variable: domains in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\mail\\src\\redirect.php on line 95, referer: http://www.nocloud.hopto.org/mail/src/login.php

a coding error perhaps?

Posted: 2005-07-27 22:06
by martin
You have notices turned on in php.ini (error_reporting). This isn't an error, just a notice from PHP that it uses an undefined variable.

Posted: 2005-08-01 08:52
by cgountanis
why cant you read the domain in the url? for example http://www.someonedomain.com:8383 and use that for domain. i have all my customers use thier domain name since it points to same ip. same can be done for global headers mail.something.com always goes to SM. i dont know php well enought to do this but should be easy.

Posted: 2005-08-01 10:35
by martin
> why cant you read the domain in the url

Ask the developers of SquirrelMail. This isn't an official squirrelmail forum in any way. It contains howto's. I will delete this and your message in a few days since it hasn't got anything to do with the HOWTO... :)