I am using the Filedepot module which uses the following URL format to link directly to files:
http:///node/15/filedepot?fid=11

I have the 'Present login form on access denied (403)' feature enabled for LoginToboggin. If a user is not logged in when attempting to access this URL, LoginToboggan's redirect after login sends the user to "http:///node/15/filedepot" cutting off the url a the '?' character.

Is this a bug or a feature? Any ideas for a work around?

Thanks much for any help! -- Kari

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dark11star’s picture

I have a similar problem when a user resets password. Link redirects to /user without any url parameters.

Please let me know if you find a solution.

Thanks,
Jason

johnvb’s picture

Bumping this. I have pages that receive an essential URL parameter to identify an underlying database record, so a URL might look like http://www.example.com/mypage?group_id=10 for example. Using Present login form on access denied (403) works except that the user ends up on http://www.example.com/mypage without the group_id parameter. Inspecting the action on the HTML form element shows it is correct including the group_id parameter so I can't see why this isn't working.

Note that if I disable Logintoboggan and hack a standard login form to change the action attribute to match, everything works nicely. So I think this is a Logintoboggan specific issue.

mudasirweb’s picture

Hi,

I am also facing the same issue, I have the redirect url with ?id=cwp attribute the 'id=cwp' attribute, is cut off from the url. Had anyone found the fix.

RedEight’s picture

Issue summary: View changes

I'm experiencing this issue as well... I'm sending users a URL via email with a specific value attached. If they are logged in when they visit the site it works perfectly. If they aren't, they hit the login toboggan login page (with the value intact), but logging in redirects them to the right url sans query parameters.... VERY annoying. I'm not sure why this is happening.

RedEight’s picture

Version: 7.x-1.3 » 7.x-1.x-dev

Steps to reproduce:

  1. Create new site on simplytest.me with Login Toboggan 7.x-1.x.
  2. Enable "Present login form on access denied (403)" from {baseurl}/admin/config/system/logintoboggan.
  3. Log out.
  4. Visit any page behind access control and add something to the query. I use {baseurl}/admin/config/system/logintoboggan?test=me.
  5. Log in.

Expected Result:

Logged in and viewing the page WITH the query.
{baseurl}/admin/config/system/logintoboggan?test=me

Observed Result:

Logged in and viewing the page WITHOUT the query.
{baseurl}/admin/config/system/logintoboggan

Workaround:

Although I did find one workaround, it isn't pretty. You can url encode the path you need including the query, then add that as a destination query.
Ex:
{baseurl}/admin/config/system/logintoboggan?test=me&destination=admin%2Fconfig%2Fsystem%2Flogintoboggan%3Ftest%3Dme

The problem with this workaround is that a logged in user will not be redirected to the destination after submitting anything on that page... It makes for a confusing experience for logged in users. If that isn't an issue for your use case, then go ahead and give it a try.

RedEight’s picture

RedEight’s picture

I'm not really sure what to make of the response in the related issue I just added. It seems to me that code should be ensuring that the query string is maintained... And yet, that's apparently why it isn't? drupal_get_destination() appears to specifically preserve the query parameters so they aren't lost... I'm at a complete loss as to why the query strings vanish as soon as I click login... It's even in the form action on the rendered html form...

jimyhuang’s picture

For those who suffer from this issue, here is the patch to solve this.

In short, drupal core set destination on each not found / access denied before logintoboggan and without query parameter except q.
The patch is to rebuild destination before calling form.

jimyhuang’s picture

FileSize
874 bytes
stevecowie’s picture

Status: Active » Needs review
FileSize
1.32 KB

Patch #9 will do the job, but I think it's probably better do to this as a from submit function. That makes it easier for site builders to see how it's done and potentially override with their own submit function if they need an alternative redirect behaviour. I've marked this for review although I appreciate the issue is old now :-(

stevecowie’s picture

Testing showed up a bug in the patch at #10. It screwed up destinations containing a fragment, such as user/login?destination=node/1#comment-form. So, here's a re-rolled version that handles both fragments and query parameters.

steinmb made their first commit to this issue’s fork.