我正在尝试构建一个登录页面,在我想登录用户后它就可以工作了,所以我使用了 make: Auth 似乎但现在 Symfony 5 不断从注册路由重定向到登录,而不先将用户保存在数据库中,当提交表单时,它在我运行 make auth cmd 之前就可以工作
大部分代码与用户身份验证有关
这是我使用的指南https://symfony.com/doc/current/security/form_login_setup.html
在 Symfony 文档上我想这就是它搞砸的原因
当您提交表单时,LoginFormAuthenticator 将拦截请求,从表单中读取电子邮件(或您正在使用的任何字段)和密码,找到 User 对象,验证 CSRF 令牌并检查密码
security:
encoders:
App\Entity\User:
algorithm: auto
providers:
users:
entity:
class: App\Entity\User
property: Username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
access_denied_handler: App\Security\AccessDeniedHandler
anonymous: false
lazy: true
provider: users
form_login:
login_path: app_login
check_path: app_login
guard:
authenticators:
- App\Security\AuthAuthenticator
logout:
path: app_logout
# where to redirect after logout
# target: app_any_route
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
繁花不似锦