openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

URL fragment doesn't persist through server-side redirect on iOS #80

Closed boonebgorges closed 6 years ago

boonebgorges commented 7 years ago

See #79. That ticket fixed the issue authenticated POSTs, but not for those that need to go through wp-login.php. I'll need to build some sort of JS-based replacement for wp-login's redirect_to behavior.

moui72 commented 7 years ago

let us know when/if this needs testing

boonebgorges commented 7 years ago

Ran out of time for this one. It's extremely difficult to debug.

boonebgorges commented 6 years ago

I've determined that this is a more general Safari problem, affecting both iOS and OSX. WP is never receiving a POST request to begin with, which, at least on the dev site, is a regression from #79.

I have a suspicion that it's a problem only for our dev site, because of the way that Safari handles form submissions that contain HTTP authentication. @drdrew42 - questions for you:

  1. Have you heard of anyone having redirect issues when using Safari in real use of OL-WW?
  2. Can you share credentials to one of the courses on the production site? I see there's an "OpeningGateways" course. Send them to me privately boone@gorg.es. If it looks like this is specific to openlabdev.org, there may be nothing to do here.
boonebgorges commented 6 years ago

@drdrew42 - thanks for sending the credentials! I can now confirm that the POST/GET problem is specific to the dev server (so no problem with #79 on production) but the URL fragment is still being lost. This gives me enough info to debug.

boonebgorges commented 6 years ago

@drdrew42 - thanks for sending the credentials! I can now confirm that the POST/GET problem is specific to the dev server (so no problem with #79 on production) but the URL fragment is still being lost.

I just put in place a kinda insane but, apparently, working fix. Here's the high-level rundown:

It's not currently possible to test this on openlabdev.org because of the weird behavior of HTTP auth + redirects/form submits + Safari.

However, I've monkey-patched the production server for the purposes of testing, and since it works, I'm going to leave it in place. @bree-z and @moui72 - the testing process here is, on Safari (mobile or otherwise):

  1. to go to the production testing site (ask @drdrew42 for creds if you don't have them)
  2. Make sure you're not logged into the OL (production)
  3. Ask for Help
  4. You should see the OL wp-login.php screen.
  5. Look at the URL. It should contain a long ?redirect_to parameter that includes the string problemId as well as a lot of other stuff. If you see a shorter redirect_to, something else has gone wrong, and you may want to try a different source problem on WW (Safari is extremely finicky)
  6. If you want, check your browser at this point for a webwork-problem-id cookie
  7. After login, you should be redirected to the proper problemId URL
bree-z commented 6 years ago

@drdrew42 could you please send creds (and URL, just to be sure I'm testing the right thing) to work@bree.bz?

thanks!

drdrew42 commented 6 years ago

I believe the course you're looking for is http://mathww.citytech.cuny.edu/webwork2/MAT1275/

I'll email the credentials.

bree-z commented 6 years ago

Thanks @drdrew42!

bree-z commented 6 years ago

I think this is working for me. I went to the site above in Safari, and after clicking 'Ask for Help' the login page opened with following URL:

https://openlab.citytech.cuny.edu/ol-webwork/wp-login.php?redirect_to=https%3A%2F%2Fopenlab.citytech.cuny.edu%2Fol-webwork%3Fpost_data_key%3Dwebwork_post_data_bfc4d4bde72ce1abf49141c912e246f0%23%3AproblemId%3Dlocal%2FReducingRationalExpressions%2FmonoDenom-NS.pg

After logging in, I was on the correct problem (ReducingRationalExpressions: Problem 1), with this URL:

https://openlab.citytech.cuny.edu/ol-webwork/?post_data_key=webwork_post_data_bfc4d4bde72ce1abf49141c912e246f0#:problemId=local/ReducingRationalExpressions/monoDenom-NS.pg

I also appear to have a webwork-problem-id cookie.

If this sounds good I think we can close this. Thanks!

boonebgorges commented 6 years ago

Yes, this sounds good. Thanks for verifying, @bree-z !