[horde] Horde / IMP preauthenticate hook

Jan Schneider jan at horde.org
Tue Jun 7 11:26:22 UTC 2011


Zitat von maxime <maxime at frequence-ecoles.net>:

> Hello,
> First thank you for all the great work that you are doing.
>
> My usernames are like "user" in the horde_users table
> and i want to authenticate with the imap server with username like :
> user at domaine.tld
> It was running well with IMP 5.0.1 and the preauthenticate hook from
> imp/config/hooks.php :
>
> <code>
> public function preauthenticate($userId, $credentials)
> {
>    $credentials['server'] = 'imap';
>    $credentials['transparent'] = true;
>    if (!substr_count($userId, '@')) {
>        $userId = $userId.'@dompaine.tld';
>    }
>    $result['userId'] = $userId;
>    $result['credentials'] = $credentials;
>
>    return $result;
> }
> </code>
>
> After upgrading to IMP 5.0.5 this don't work any more.
> If i login to horde i have usernale like "user at domaine.tld" for horde
> too (so i'am not the same user).
>
> I have to write another hook in horde/config/hooks.php like this to
> strip the '@domaine.tld' from thez horde username :
>
> <code>
> public function authusername($userId, $toHorde)
> {
>     if (substr_count($userId, '@')) {
>         $parts = explode('@',$userId);
>         $userId = $parts[0];
>     }
>     return $userId;
> }
> </code>
>
> So now it only works with the 2 hooks.
> Is it a normal beaviour ?

Try this:  
http://git.horde.org/horde-git/-/commit/a95f8a4259ceaae0b421894062c28df7c17bd167

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the horde mailing list