为了账号安全,请及时绑定邮箱和手机立即绑定

Symfony 4 记住我 cookie 未设置

Symfony 4 记住我 cookie 未设置

PHP
人到中年有点甜 2022-05-27 16:16:39
我正在使用 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


查看完整回答
反对 回复 2022-05-27
  • 1 回答
  • 0 关注
  • 118 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号