[horde] [SOLVED] Horde / IMP preauthenticate hook

maxime maxime at frequence-ecoles.net
Tue Jun 7 13:26:28 UTC 2011


Le mardi 07 juin 2011 à 13:26 +0200, Jan Schneider a écrit : 
> 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/
> 
It works perfectly, thanks.


-- 
Maxime Chavagne
maxime at frequence-ecoles.org

Fréquence écoles
8, rue Chaponnay
69003 Lyon
04 72 98 38 32

Et plus d'infos sur notre site : www.frequence-ecoles.org




More information about the horde mailing list