Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return value in login_form not working

I have a login form at the following page:

site.com/en/downloads

“en” is the user_language ( and is stored as such in a global var )

when I login, the form redirects me to:

site.com/downloads

While it should redirect me to the URL with my user_language

I’ve tried numerous things, but the value of the return value always gets ignored.

  • return =”{site_url}/{user_language}/downloads”
  • return =”{site_url}”
  • return =“http://site.com”
  • return =“http://google.com”
  • return =“about/index”

they all redirect to site.com/downloads.

the code that is being outputted ( for the last example ) looks like this:

<form method="post" action="http://site.com/"  >
<div class='hiddenFields'>
<input type="hidden" name="XID" value="9fae3b1b5fcf882776da6638706595af73a7b15d" />
<input type="hidden" name="ACT" value="7" />
<input type="hidden" name="RET" value="about/index" />
<input type="hidden" name="site_id" value="1" />
</div> 

I have an .htaccess that looks like this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L] 

UPDATE:

I tried using freemember as suggested, but the problem remains the same:

I've set the return value to "about/index", but I'm still being redirected to site.com/downloads.

The code generated by freemember looks solid though, so something must be overriding the return value.

<form method="post" action="http://site.com/downloads"  >
<div class='hiddenFields'>
<input type="hidden" name="XID" value="d9483688fbf63d9ea47e89a66e074b99f5b8465c" />
<input type="hidden" name="ACT" value="18" />
<input type="hidden" name="_params" value="wvkEsN96mPfmlhgerM2ppxGbMmiLJrz0Ntn7apKer/rmBpQaUozvSM0TvkVN66QlX/ptCM1IQGsuZuw7X3mzlOMCFIUyYFpbZy5h7nfPJMiHLdpqXqwBFOiA/zcNW0GKAIicv4JPAS2mfHKQE+mb2Ct0L+jhGz0NlSdELuMOeqQPJJ3B7U90D5w/sKTeaX5zaOMSvKJ4LZ7xP0Dn+UxE9g==" />
<input type="hidden" name="return_url" value="about/index" />
<input type="hidden" name="site_id" value="1" />
</div>
like image 924
janvl Avatar asked Oct 31 '12 08:10

janvl


3 Answers

I finally figured it out.

Apparently I was still using a small plugin called "Twomile Login Redirect" which hijacked my login code ( even when it was disabled, I had to remove it )

So all is well now.

Lesson learned: remove old plugins :)

like image 134
janvl Avatar answered Sep 19 '22 17:09

janvl


When you use the return="{user_language}/about/index" parameter as you mentioned above, does it correctly output the RET variable in the HTML code? How about just adding your own RET hidden input field? Just put this inside your login form somewhere:

<input type="hidden" name="RET" value="{user_language}/about/index" />

According to the HTML spec, if two inputs have the same name, then the later one will override any previous ones, so there is no problem doing it this way.

Alternatively, you could try using the Freemember plugin - you might have more luck with the return URL, and you can avoid the nasty grey redirect pages as well. </shameless-plug>

like image 24
Adrian Macneil Avatar answered Sep 16 '22 17:09

Adrian Macneil


i might be looking at this to superficcially, but couldn't you use

return =”{segment_1}/downloads”
like image 22
Jelle Dijkstra Avatar answered Sep 16 '22 17:09

Jelle Dijkstra