If you start on a url that has a query string, after you have authenticated using bakery and logged in, the query string will be lost. I think we need to store this in the cookie data, so that we can pass these additional query parameters to drupal_goto().

Here is an initial patch. This is rolled against a site and not the bakery module, as I don;t have the repo checked out atm, sorry :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

Status: Active » Needs review
FileSize
2.82 KB

Here is a patch against the 7.x-2.x branch.

coltrane’s picture

FileSize
2.54 KB

#1 didn't apply cleanly to 7.x-2.x for me, re-rolled and added a comment

With this I could login from D7 sub-site at a URL like user/login?destination=filter/tips&s=1 and would end up at /filter/tips?s=1 correctly.

coltrane’s picture

There are tests up at https://github.com/bjeavons/Bakery-Chef for this. cucumber features/queryarguments.feature The D7 login scenario passes.

damiankloip’s picture

FileSize
2.09 KB

Here is a patch for the 6.x-2.x branch.

damiankloip’s picture

I created a pull request on github for the D5 patch: https://github.com/bjeavons/bakery5/pull/2

coltrane’s picture

Status: Needs review » Needs work

Login from any D7 subsite with a query parameter like ?sdf=sdf is ending up back with path node%3Fsdf%3Dsdf and 404 message. I think this is because query arguments get added to the form action destination and then lost as separate query arguments.

Edit, query parameters are passed through when the login happens on a path, but when logging in on the front page (/) they are lost.

coltrane’s picture

FileSize
2.85 KB

Fix for D7. D6 patch needs work because drupal_get_query_parameters() doesn't exist in D6.

damiankloip’s picture

That's a good point :)

damiankloip’s picture

FileSize
508 bytes
2.1 KB

Rerolled the 6.x-2.x patch, I think we only need to unset ['q']?

coltrane’s picture

FileSize
2.07 KB

The query argument to drupal_goto() was wrong for 6. Updated patch.

With these two patches the following scenarios pass:

* As a Bakery user, I want my query arguments to carry through login on D6 from path (/user/login)
* As a Bakery user, I want my query arguments to carry through login on D6 (no path)
* As a Bakery user, I want my query arguments to carry through login on D7 on a path
* As a Bakery user, I want my query arguments to carry through login on D7 (no path)

However, on a URL like "http://subsite.example.com/?destination=filter/tips&foo=bar" I'll end up on filter/tips but without "foo=bar".

Are there any other tests you can think of?

It strikes me that all of the query arguments could be passed along with destination, instead of as a separate cookie data element. That would probably run require URL decoding/encoding tho. What do you think Damian?

coltrane’s picture

Title: Query string is not kept during authentication » Support extra query arguments along with query destination and during registration

I re-reviewed this today and think it looks good for login. Committed http://drupalcode.org/project/bakery.git/commit/f9030d5 and http://drupalcode.org/project/bakery.git/commit/db96ba4

Thanks @damiankloip!

Leaving open to handle the remaining case of query arguments when destination is set as well as handling registration.

coltrane’s picture

Issue summary: View changes

Updated issue summary.

msupko’s picture

Issue summary: View changes
FileSize
510 bytes

I'm having a few issues with http://drupalcode.org/project/bakery.git/commit/f9030d5 and URL encoding. For example, suppose a visitor tries to go to this URL:

http://www.example.com/search/stuff?page=2

In our case, r4032login module redirects them to:

http://www.example.com/user?destination=search/stuff%3Fpage%3D2

Without bakery module enabled, this works as expected—user logs in, goes directly to the right page. With bakery module enabled, the user gets redirected to a 404 at:

http://www.example.com/search/stuff%3Fpage%3D2

It seems the code in this commit is checking $cookie['data']['destination'] for a '?', which it will never find since it's encoded as %3F instead, at least in our case. I'm attaching a patch to decode the destination before redirecting the user—this resolves the issue for us.

  • coltrane committed f9030d5 on 7.x-4.x
    Issue #1954462 by damiankloip, coltrane: Fixed Query string is not kept...