[imp] login modifications

Arshavir Grigorian ag at m-cam.com
Thu Jan 13 16:30:30 PST 2005


Andrew Morgan wrote:

>
>
> On Thu, 13 Jan 2005, Arshavir Grigorian wrote:
>
>> Arshavir Grigorian wrote:
>>
>>> Hi,
>>>
>>> I have to deal with an Exchange IMAP server that requires the users 
>>> to type in the following logins:
>>>
>>> domain/username/alias
>>>
>>> I am wondering whether there is a way (short of hacking the code) to 
>>> configure IMP/Horde to automagically add the domain and the alias 
>>> parts, so that the user only has to type in the username.
>>>
>>> Thanks for any pointers.
>>>
>>>
>>> Arshavir
>>
>>
>> Replying to my own email, I think I found a hook 
>> (_passwd_hook_username) that will do what I want. I wrote a very 
>> simple hook and tried to enable it in horde/config/conf.php
>>
>> as
>>
>> $conf['hooks']['username'] = true;
>>
>> but I don't think my hook get's called, otherwise it should have let 
>> me log in, but it does not.
>>
>> if (!function_exists('_passwd_hook_username')) {
>>   function _passwd_hook_username($userid)
>>   {
>>       return 'm-cam/'.$userid .'/ag';
>>   }
>> }
>>
>> Thanks in advance for any pointers.
>
>
> You don't say which version of IMP you are using, but I use the 
> following hook in IMP 3 to make sure all usernames are lowercase:
>
> $conf['hooks']['vinfo'] = 'imp_get_vinfo';
>
> if (!function_exists('imp_get_vinfo')) {
>         function imp_get_vinfo ($type = 'username') {
>                 if ($type == 'username') {
>                         return strtolower($_SESSION['imp']['user']);
>                 } else {
>                         return new PEAR_Error('invalid type: ' . $type);
>                 }
>         }
> }
>
>
> You can easily use the vinfo hook to do what you want.  Just replace 
> the line above:
>
>         return strtolower($_SESSION['imp']['user']);
>
> with:
>
>         return 'm-cam/' . strtolower($_SESSION['imp']['user']) . '/ag';
>
>
> (I included the strtolower so that users don't get different prefs 
> when they vary the case of their login name)
>
>
>     Andy


My bad, I am using Horde 3.0 with IMP-H3 4.0. I changed a few things in 
your solution and it's working. Many thanks.

Arshavir




More information about the imp mailing list