[horde] USERNAME Hook - help required.

Jan Schneider jan at horde.org
Fri Aug 16 07:44:46 UTC 2013


Zitat von ANANT S ATHAVALE <asa at isac.gov.in>:

> Dear List,
>
> My authentication is based on LDAP which is case insensitive.  I  
> want username to be always lower case and also if there any blank  
> space (either at starting or trailing to be trimmed)
>
> I have written the hook as below.  Please suggest, if it is wrong:
>
>     public function authusername($userId, $toHorde)
>     {
>         return $toHorde
>             ? trim(Horde_String::lower($userId) . '@isac.gov.in')
>             : trim($userId) . '@isac.gov.in';
>     }
>
> I want basically that the preferences to be stored with  
> username at isac.gov.in, where username should be always in lower case  
> and it should not have any space characters.
>
> Please suggest.

It also adds the domain part, not sure if this is intended.

More important though is the reverse direction, which you have wrong.  
The trim() is no longer necessary because you already trimmed in the  
other direction. And you have to *remove* the domain part, not add  
them another time.
-- 
Jan Schneider
The Horde Project
http://www.horde.org/



More information about the horde mailing list