Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony 2 & FOSUserBundle : authenticate user after resetting password
    primarykey
    data
    text
    <p>When overriding FOSUserBundle resetting password controller, there is a function call to "authenticateUser" method (line 104) :</p> <p><a href="https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Controller/ResettingController.php#L104" rel="nofollow">https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Controller/ResettingController.php#L104</a></p> <pre><code>.... $this-&gt;authenticateUser($user); .... </code></pre> <p>My problem is that I already override the Symfony authentication handler, and have my own logic when a user logs in.</p> <p><strong>EDIT</strong> Here is my authentication handler :</p> <pre><code>&lt;?php /* ... all includes ... */ class AuthenticationHandler implements AuthenticationSuccessHandlerInterface, LogoutSuccessHandlerInterface { private $router; private $container; public function __construct(Router $router, ContainerInterface $container) { $this-&gt;router = $router; $this-&gt;container = $container; } public function onAuthenticationSuccess(Request $request, TokenInterface $token) { // retrieve user and session id $user = $token-&gt;getUser(); /* ... here I do things in database when logging in, and dont want to write it again and again ... */ // prepare redirection URL if($targetPath = $request-&gt;getSession()-&gt;get('_security.target_path')) { $url = $targetPath; } else { $url = $this-&gt;router-&gt;generate('my_route'); } return new RedirectResponse($url); } } </code></pre> <p>So, How could I call the "onAuthenticationSuccess" method from my authentication handler in the ResettingController ? In order to avoid rewriting the same code...</p> <p>Thanks for your help !</p> <p>Aurel</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload