https://bugs.contribs.org/show_bug.cgi?id=9249

John Crisp <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CLOSED                      |CONFIRMED
                 CC|                            |[email protected]
         Resolution|FIXED                       |---

--- Comment #10 from John Crisp <[email protected]> ---
I am setting this back to confirmed.

If I login as john I get "Login success for john (Horde user [email protected])"

If i use [email protected] to login it fails.

A quick check on the regex shows

preg_match('/[^.]+\.[^.]+$/', $vdomain, $matches);

HTTP_HOST = mydomain.co.uk
$vdomain = ".co.uk"

HTTP_HOST = mail.mydomain.co.uk
$vdomain = ".co.uk"

My solution was to modify the template and get the system DomainName property
like this (it isn't clever but works):

I forgot to back up the original template file so can't diff it right now...

Note you could also add a DB key to override the system domain name if required
but I haven't coded this.


//100Username
{
use esmith::ConfigDB;
my $configDB    = esmith::ConfigDB->open_ro or die("can't open Config DB");
my $domainname = $configDB->get("DomainName")->value;

$OUT .=<<'START';
class Horde_Hooks
\{
      public function preauthenticate($userId, $credentials)
      \{
         return array( 
                'userId' => Horde_String::lower($userId),
                'credentials' => $credentials
      );

      \}

      public function authusername($userId, $toHorde)
      \{
          // Example #1: Append the virtual domain to the username.
          // ex. $HTTP_HOST = 'mail.mydomain.com', $userId = 'myname' returns:
          // '[email protected]'

START

$OUT .= "          \$vdomain = \'$domainname\';\n";

$OUT .=<<'END';

          if ($userId == 'adminremoveuser') \{
               return $userId;
          \} else \{
             if ($toHorde) \{
                 return $userId . '@' . $vdomain;
             \} else \{
                  return (substr($userId, -strlen($vdomain)) == $vdomain)
                  ? substr($userId, 0, -strlen($vdomain)-1)
                  : $userId;
             \}
          \}
      \}
\}

END
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
_______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail [email protected]
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/

Reply via email to