登录失败后,应用程序不会重定向到登录页面。这是我的 security.yml 配置:
security:
encoders:
Acme\SecurityBundle\Entity\Users: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
providers:
main:
entity: { class: Acme\SecurityBundle\Entity\Users}
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/login$
security: false
secured_area:
pattern: ^/admin/
form_login:
check_path: /login_check
login_path: /login
logout:
path: /logout
target: /home
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
这是我的控制器:
class LoginController extends Controller {
/**
* @Route("/login",name="login")
*/
public function loginAction() {
//displays login form and renders the login.html.twig
}
/**
* @Route("/login_check", name="login_check")
*/
public function loginCheckAction() {
// The security layer will intercept this request
}
登录失败后,我收到错误消息:
The controller must return a response (null given). Did you forget to add a return statement somewhere in your controller?
500 Internal Server Error - LogicException
我尝试了 symfony 附带的演示中的登录部分。我发现了同样的结果。登录失败后,我应该进行哪些修改才能重定向到登录表单?