-1

How to implement a before filter that asks to confirm a user password to access some routes?

I'd see this when using Laravel (password.confirm middleware) but I could find similar for Symfony.

Thank you.

  • have you tried to solve it with an EventListener. – alessandro_podo Apr 13 '21 at 19:08
  • This is the answer you are looking for. [https://stackoverflow.com/questions/43947102/symfony-check-user-authorization-inside-event-listener](https://stackoverflow.com/questions/43947102/symfony-check-user-authorization-inside-event-listener) – KMAHY Apr 21 '21 at 12:08

1 Answers1

0

I can't comment so @alessandro_podo.. I'd try eventlistener but I don't know how to redirecto to login page and back to the current route. @KMAHY that's not what I need.. I don't wanna check isGranted I want to ask for user to enter username/password even if he is logged in.

  • sry i didn't get noticed. You shoud not redirect to the login page. Create a page with a form for the password. in the event listener check for your route, if it hit, dann redirect to the new page with the form. Checkt the password with the same class as in the login Form. If the password is right, redirect. You can save the route in the Session – alessandro_podo May 03 '21 at 17:44