Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect paramater does not work #658

Open
ivok opened this issue Dec 10, 2016 · 6 comments
Open

Redirect paramater does not work #658

ivok opened this issue Dec 10, 2016 · 6 comments

Comments

@ivok
Copy link

ivok commented Dec 10, 2016

I am using zfcuser on ZF3 and when pass a redirect parameter to login page it does not work. In zf2 I did not have any problems.
Example: /user/login?redirect=/about

Also, if I enter dummy data in form and the forms fails, but the redirect param disappererd.

@ivok
Copy link
Author

ivok commented Dec 11, 2016

Why the redirect param in query/post expects a value which is the name of the route? The getRedirect() method assembles the route by its name and return redirect string. In that way you can redirect only to a named route not a url. If I want to redirect to e specific url, let say .../product/sample-product-one, I actualy cant do this because the getRedirect() and query param "redirect" expects a name of route not a specific endpoint?

The getRedirect() method also brakes at switch statement. If I send trough redirect param a valid route name like "home/about" it is transformed to "%2Fhome%2Fabout" and the assemble() method of the router fails becouse it cannot match route name. It should be urldecoded before trying to assemble

Also the method routeExists() returns always false, no matter that I passed a valid route name, for the same reasons above?

To make this functionality partialy works, I had to refactor routeExists() method and getRedirect() method also.

But the big problem persist. In that way, we cannot redirect user to a specific url... not a named route. I want to redirect user on a specific product/article/page with id/slug/param.

@Perfect-Web
Copy link

i confirm that 2.x on zf3 doesnt work, i have the same problem

@ivok
Copy link
Author

ivok commented Dec 11, 2016

https://github.com/ivok/ZfcUser/tree/redirect

Here I have a possible solution with added availability of passing not only route names but a specific url route

@ivok
Copy link
Author

ivok commented Dec 11, 2016

@Perfect-Web You can use my fork as you have to point to redirect branch. But I did not made any tests. It works for me now, but not sure what future problems may occur

"require": {
       ...
       "zf-commons/zfc-user": "dev-redirect"
}
"repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:ivok/ZfcUser.git"
        }
    ],

@imonteiro
Copy link

Hi @ivok

I have the same issue with ZF2 (using ZfcUser v1.4.4). With your branch the redirect works as expected.

It's a very strange behavior... it's a bug? or I'm missing something?

@ivok
Copy link
Author

ivok commented Apr 6, 2017

@imonteiro This is not a bug. This is a good practice to allow only named routes. But in some cases I need this functionality and that is why I made this fork. But you have to be very careful for vulnerabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants