[horde] (partially solved) how to by pass login page of imp

Patrick DUBAU patrick.dubau at alsace.iufm.fr
Tue Dec 18 09:07:37 UTC 2007


Patrick DUBAU a écrit :
> Torsten Homberger a écrit :
>   
>> Patrick DUBAU wrote:
>>   
>>     
>>> we want our users to launch horde/imp through  our portal (only one identification
>>> needed), so i want to by pass the login page from imp. 
>>> Is there any solution ?
>>>     
>>>       
>> Try these lines of code:
>>
>> --------8<---------8<----------
>> <?php
>> @define('AUTH_HANDLER', true);
>> @define('HORDE_BASE', '/path/to/your/horde');
>> require_once HORDE_BASE . '/lib/base.php';
>> require_once HORDE_BASE . '/imp/lib/api.php';
>>
>> function countUnseenMails() {
>>         require_once IMP_BASE . '/lib/Mailbox.php';
>>         $GLOBALS['horde_api']['stream'] =_imp_getStream();
>>         $imp_mailbox = &IMP_Mailbox::singleton();
>>         $unseenMessages = $imp_mailbox->unseenMessages();
>>         return count($unseenMessages);
>> }
>>
>> function sso($user, $pass, $server='localhost') {
>>         return _imp_authenticate($user, array('password' => $pass),
>> array('server' => $server));
>> }
>> --------8<---------8<----------
>>
>>
>> Now you should be able to authenticate with
>> sso($user, $pass);
>>
>> The function countUnseenMails() should return the amount of unseen mails.
>>
>> Good luck,
>> Torsten Homberger
>>
>>   
>>     
> Hi Torsten,
>
> thank you for your replay, but i don't understand everything
>
> - does i have to create a file like toto.php with the code above in 
> /usr/share/horde3/imp and then call it with 
> http://x.x.x.x/horde3/imp/toto.php?user=firstname.name&pass=password ?
> thar's what i did but i get only a blank page
>
> I missed something, can you please help me further more ?
> Thx
>
>
>   
i found :
in  redirect.php at line 115 i add
$imapuser=$_GET['user'];
$pass=$_GET['pass'];
and i call the page by :

http://x.x.x.x/horde3/imp/redirect.php?user=firstname.name&pass=xxx

=> no more authentification  is needed

One last thing i miss : by default no mailbox is shown (we have to click 
on a mailbox), i would like to show up immediately the icome mailbox 
with the mailsin it.
Is there a way to do so ?




More information about the horde mailing list