ZF-Commons / ZfcUser

A generic user registration and authentication module for ZF2. Supports Zend\Db and Doctrine2. (Formerly EdpUser)
BSD 3-Clause "New" or "Revised" License
497 stars 343 forks source link

Problem with custom redirect #551

Open markgerald opened 9 years ago

markgerald commented 9 years ago

I'm having trouble with the custom redirect.

I am using the code below to redirect:

        if (!$auth->hasIdentity() AND (
                $matchedRoute == "empresas" OR
                $matchedRoute == "empresas/default" OR
                $matchedRoute == "dashboard" OR
                $matchedRoute == "dashboard/default" OR
                $matchedRoute == "empresas-sugeridas" OR
                $matchedRoute == "empresas-sugeridas/default"
            )
        ) {

            //GERANDO URL A PARTIR DA ROTA ATUAL
            $redirect = $e->getRouter()->assemble(
                $routeMatch->getParams(),
                array(
                    'name' => $routeMatch->getMatchedRouteName(),
                )
            );

            $response = $e->getResponse();
            $response->getHeaders()->addHeaderLine(
                'Location',
                $e->getRouter()->assemble(
                    array(),
                    array(
                        'name' => 'zfcuser/login',
                        'query' => array('redirect' => $redirect)
                    )
                )
            );
            $response->setStatusCode(302);
            return $response;

But is not working. Can anyone help me? (I'm using the latest version of ZfcUser - 1.2.1), PS: This code worked before I upgrade to 1.2.1.

markgerald commented 9 years ago

After this change, the redirect parameter passed to the loginAction is totally ignored in the authenticateAction. Anyone can help??

pierrejochem commented 6 years ago

I have the same issue :-(

jroedel commented 6 years ago

Yep, I think this was a problem introduced very early on in the development cycle. I'm still using 1.0.0 because of this problem. It'd be amazing if someone could take a closer look at this, I'd love to bring myself up-to-date! I'm afraid I don't understand enough about the inner-workings to roll out a pull request...