我正在使用 Symfony 4 开发一个站点,我注意到记住我的功能不起作用(根本没有设置 cookie)。我遵循了本教程:https://symfony.com/doc/4.4/security/remember_me.html我也阅读了很多类似的问题,但没有一个能解决我的问题。这是我的 security.yaml 配置:security: encoders: App\Entity\User: algorithm: auto # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers providers: # used to reload user from session & other features (e.g. switch_user) app_user_provider: entity: class: App\Entity\User property: username firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: anonymous: lazy guard: authenticators: - App\Security\LoginFormAuthenticator logout: path: app_logout # where to redirect after logout # target: app_any_route remember_me: secret: '%kernel.secret%' lifetime: 604800 # 1 week in seconds path: / # 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 }这是我的表格:<form method="post"> <div class="form-group"> <label for="inputUsername">Username</label> <input type="text" value="{{ last_username }}" name="username" id="inputUsername" class="form-control" required autofocus> </div> <div class="form-group"> <label for="inputPassword">Password</label> <input type="password" name="password" id="inputPassword" class="form-control" required> </div>
1 回答

手掌心
TA贡献1942条经验 获得超3个赞
这已被确认为一个错误,并已在 Symfony 版本 4.4.1 中解决。如果您遇到此错误,请从 4.4.0 升级到 4.4.1。
这是修复此问题的提交:https ://github.com/symfony/symfony/pull/34627
这些是变更日志:https ://symfony.com/blog/symfony-4-4-1-released
- 1 回答
- 0 关注
- 118 浏览
添加回答
举报
0/150
提交
取消