Roundcube Community Forum

Miscellaneous => Roundcube Discussion => Topic started by: bocode on February 02, 2010, 09:25:53 AM

Title: RC suffering from multiple redirects
Post by: bocode on February 02, 2010, 09:25:53 AM
I'm a newbie and trying to get something done with RC. So here goes my problemo:

1) i've a simple HTML form page which takes username/password for RC (am not using the index.php as login page).

2) the login info is posted to a simple php and it puts the form data in session and redirects to rc/index.php. Here is the code for this simple php:
-----------------------------------
   session_start();
   $_POST['_user']=$_POST['uname'];
   $_POST['_pass'] = $_POST['passwd'];
   $_SESSION = $_POST;
   session_write_close();
   header("Location: rc/index.php");
-------------------------------------

3) at the top of RC index.php page i've the following:
------------------------------
session_start();
$_POST = $_SESSION;
session_write_close();
-------------------------------
That is all when it comes to changing the files or writing code.

Now when i enter my uname/passwd in the HTML form of step 1 and hit submit, the index.php of RC is calling itself over and over making browser to bail out. My Apache log has this line repeating over and over:

GET /rc/?_task=mail HTTP/1.1" 302 -

So my question is why does this happen? If i use rc/index.php directly then it works just fine (even with the lines in step 3 at the top of the index.php).
Title: RC suffering from multiple redirects
Post by: SKaero on February 02, 2010, 11:13:50 AM
There is no reason to be changing RoundCube's core code use a plugin instead. The auto logon plugin should work for what your trying to do: http://trac.roundcube.net/browser/trunk/roundcubemail/plugins/autologon
Title: RC suffering from multiple redirects
Post by: bocode on February 02, 2010, 11:34:32 AM
Thank you for the reply.

autologon plugin makes sense when am on localhost. What am trying to do is to have a common login page for squirrelmail and roundcube. I succeeded in making the squirrelmail work with the above technique but when it comes to RC, it fails. I do not understand why this fails. Why does RC do multiple redirects?
Title: RC suffering from multiple redirects
Post by: bocode on February 04, 2010, 10:28:20 PM
Hello All,

Am still waiting for a deployable solution for this issue. Is there anybody out there to help me with this?

Thank you
Title: RC suffering from multiple redirects
Post by: rosali on February 05, 2010, 12:38:55 AM
Check my 'logout_redirect' plugin (bundled with MyRoundcube plugin - see signature).

There is a AJAX login sample included. This should work for your purpose.