Advertisement:

Login redirect problem

Aloittaja bijoy, kesäkuu 25, 2006, 09:07:30 IP

« edellinen - seuraava »

bijoy

(I apologize if this has been posted already.  I did search the forum for return url and only a 'logout redirect problem' showed up and it was unrelated)

I found the returnurl parameter not being used properly while logging into the Joomla-SMF integration.  It is always getting redirected to the SMF front page.   I tracked the problem to the components/com_smf/smf.php where it is trying to redirect based on $_SESSION['return'] parameter.  The mod_smf_login module parameter for login redirect is set properly in jos_modules table (login=2).  For some reason the $_SESSION['return'] parameter is empty, but the value submitted from login form is available in $_REQUEST['return'],  I aded the following piece of code (the first if statement after the comments below) to take it from request parameter.


        // Default, in case we couldn't find anything, or the admin forgot to configure the login module
        // direct to SMF => 1
        // direct to frontpage => 0
        // option 2 cannot be used for default
        if (empty($_SESSION['return'])) # if session return value is empty, take it from request
                $_SESSION['return'] = $_REQUEST['return'];
        if (empty($_SESSION['return']) && ($returncheck == '' || $returncheck == '2'))


Is this the right way to fix it?  Is there any reason why the $_SESSION['return'] parameter is empty?

Thanks,
Bijoy

Orstio

Let's start with some information.

You obviously have bridge 1.1.4.

What version of SMF?

Can we see a URL?

bijoy

Thanks for the quick response, Ostrio.

SMF 1.1 RC2
Joomla 1.0.8
Bridge 1.1.4

The url is not available externally now.  Sorry about that.

Also, I found an additional related problem.  The hack I did does not work for login failures.  After relogin from the failed login page, it is going back to the SMF.

Thanks a ton.
-bijoy

Orstio

Is the forum wrapped or unwrapped?

bijoy


Orstio

Does the login module show on the forum page?

bijoy

Yes, it shows up on the SMF page.  Also I have added to a few of my Joomla pages on the left side bar.  When I login from forum it does go to the SMF.  But when I login from the Joomla pages, it is redirected to SMF.  The login form has both return (value=joomla-url) and returnurl (value=2) hidden fields.

I don't want to deviate now, but I do have a side question too.  Is there any way I can call the integration auth routies directly from my php scripts (like mosMainFrame->login() in Joomla)?  That way, I guess, I can control the navigation completely.

Orstio

Is there anything in your SMF error log?  Does your SMF database user have access to your Joomla database?

LainaaI don't want to deviate now, but I do have a side question too.  Is there any way I can call the integration auth routies directly from my php scripts (like mosMainFrame->login() in Joomla)?  That way, I guess, I can control the navigation completely.

This will be possible in Joomla 1.5.  There is at least one situation of which I know in which it isn't such a good idea right now.

bijoy

There is nothing in the PHP error logs.  And I am using the same database for both Joomla and SMF.
LainaaThis will be possible in Joomla 1.5.  There is at least one situation of which I know in which it isn't such a good idea right now.

Can you share this with me? 

Also  I am not sure if I wrote my question clearly.  What I wanted to do is to re-use the SMF/Bridge login/logout methods directly from a couple of custom scripts, without sending the request to the com_smf module.  The Joomla and SMF pages will still use the default authentication methods.  My intent is to use the same Joomla user database for my authentication.  It is different from using an external authentication module.

Orstio

LainaaThere is nothing in the PHP error logs.

If you go to your SMF admin panel, and click on Forum Error Log, is there anything in there?

LainaaCan you share this with me? 

Also  I am not sure if I wrote my question clearly.  What I wanted to do is to re-use the SMF/Bridge login/logout methods directly from a couple of custom scripts, without sending the request to the com_smf module.  The Joomla and SMF pages will still use the default authentication methods.  My intent is to use the same Joomla user database for my authentication.  It is different from using an external authentication module.

Well, then I either I am very confused, or you are very confused.  You asked about using mosMainFrame->login(), which is Joomla, not SMF.  The SMF login is set up to be used externally.  Just make sure to include SSI.php.

bijoy

Nothing serious in the SMF Forum Error Log (Thanks for pointing me there).  Here it is.

8: Undefined index: return
File: /joomla/components/com_smf/smf.php
Line: 694


It is on the line that I added; I guess, REQUEST/SESSION return value is empty.

On the second question, you gave me the solution.  SSI.php is what I wanted.  If I just include it, would it open the session automatically with the user id and hashed-password from the request?  The ssi_login() method in SSI.php is to print out the login form.

Thanks a lot,
Bijoy

Orstio

Lainaa8: Undefined index: return
File: /joomla/components/com_smf/smf.php
Line: 694


That is the problem with the redirect.

Are you sure this is bridge 1.1.4? 

bijoy

LainaaIt is on the line that I added; I guess, REQUEST/SESSION return value is empty.

Ostrio, I am not sure if this is the reason.  The warning is in the code I added, and it comes only in the password failure cases, as the re-auth page does not contain return parameter in the request.

If I remove the added line, there are no warnings; but the system does not redirect properly.

Thanks,
Bijoy

Advertisement: