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

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
SiC_Goat
New user
New user
Posts: 7
Joined: 2004-10-14 06:44

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

Post by SiC_Goat » 2004-10-15 21:47

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

User avatar
FAWTS
Normal user
Normal user
Posts: 74
Joined: 2005-06-18 15:25
Location: Paris
Contact:

Post by FAWTS » 2005-07-19 03:56

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...
Apache 1.3.33 PHP Version 4.4 hMailServer 4.1-B136 OS : Win XP SP2 AV : ClamAV 0.86.1

fsdfdg

Post by fsdfdg » 2005-07-27 21:51

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?

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2005-07-27 22:06

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.

cgountanis
Normal user
Normal user
Posts: 105
Joined: 2005-07-01 00:54
Location: USA

Post by cgountanis » 2005-08-01 08:52

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.

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2005-08-01 10:35

> 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... :)

Post Reply