我正在使用 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 關注
- 132 瀏覽
添加回答
舉報
0/150
提交
取消