简体   繁体   中英

Debug Login in Symfony 2.1, finding an inexisting route

In an existing Symfony 2.1 Application the login is broken. The person who initially wrote the app, isn't there any more so I have to debug the login process, to find out where the error occurred. When you try to login, basically you get redirected to the home page, but without being logged in, not much to start from, I know. I checked if mcrypt is available, then I tried to go step by step. There a strange thing occurred.

The twig file has this line in it:

<form class="loginBox" action="{{ path('foobar_security_login_check', {'_locale': 'de'}) }}" method="post">

Which is rendered as

<form method="post" action="/login/check" class="loginBox" style="display: block;" novalidate="novalidate">

Looks good like this, right? That's what I thougt, until I wanted to know, which controller is called by the loginform.

php app/console router:debug foobar_security_login_check

  [InvalidArgumentException]                                
  The route "foobar_security_login_check" does not exist.  

router:debug [name]

So how's that possible? And how can I find the controller it is attached to?

When I check the routing.yml file, there is a foobar_security_login_check entry:

foobar_security_login_check:
  pattern:      /login/check

Which explains, why the route can be rendered in TWIG. It still doesn't tell me, to where that POST request is sent.

I don't know why you can't debug the route.

However, I can answer your original question: What controller is called. No controller is called. It's picked up by the Security Authentication Listeners, which is an event listener listening on the kernel.request event: https://github.com/symfony/Security/blob/master/Http/Firewall/AbstractAuthenticationListener.php#L179

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM