Restore request in 2.3-dev doesn't work correctly
- o5
- Member | 416
Hello,
I think in @dev version is a bug with method $presenter->restoreRequest().
Prepare reproducible environment:
git clone git@github.com:nette/examples.git
cd examples/CD-collection/
composer install --prefer-dist
User story:
- Sign in into app
- Go to “Add new album” screen
- Delete all cookies via Developers Tools
- Refresh page
- You have been redirect to login form with backlink param
- After successfully re-sign in, you're in “Add new album” screen, but URI wasn't change and if you do refresh page, you get “Confirm Form Resubmission”.
The same story works fine (without form resubmission) in Nette v2.2.2.
Last edited by o5 (2014-06-27 13:02)
- enumag
- Member | 2118
This behaviour is correct.
The method restoreRequest only restores the request without changing url (it can't actually change it because restoring post requests wouldn't work). The fact you got redirected before was an unintentional sideeffect caused by canonicalization in some cases (not always so it was not reliable).
We should add some method redirectToStoredRequest()
or something
like that which would ignore the post data in the stored request and
redirect.
Last edited by enumag (2014-06-27 18:46)
- Majkl578
- Moderator | 1364
Ignoring the fact it is masssive BC break of common use-case of most websites (and thus as well violates POST/REDIRECT/GET pattern), how do you suggest to replace the behavior? Calling restoreRequest() terminates code execution, so you can't place redirect after it. And any other way is imho hackish.
- enumag
- Member | 2118
I've already explained reasons for this change on GitHub. As I've said the old behavior (although relied on by many people) was neither intended nor reliable, it was just a side-effect of other things.
Also it's not my fault that this change got into Nette 2.2. At the time I was convinced that the next version after 2.1 will be 3.0 where such BC break would be fine.
Last edited by enumag (2014-06-28 22:19)
- David Grudl
- Nette Core | 8218
This will be solved (ie. replaced in master) by https://github.com/…ation/pull/4