第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Symfony 5 不斷從注冊(cè)路由重定向

Symfony 5 不斷從注冊(cè)路由重定向

PHP
慕婉清6462132 2023-07-21 15:42:11
我正在嘗試構(gòu)建一個(gè)登錄頁面,在我想登錄用戶后它就可以工作了,所以我使用了 make: Auth 似乎但現(xiàn)在 Symfony 5 不斷從注冊(cè)路由重定向到登錄,而不先將用戶保存在數(shù)據(jù)庫(kù)中,當(dāng)提交表單時(shí),它在我運(yùn)行 make auth cmd 之前就可以工作大部分代碼與用戶身份驗(yàn)證有關(guān)這是我使用的指南https://symfony.com/doc/current/security/form_login_setup.html在 Symfony 文檔上我想這就是它搞砸的原因當(dāng)您提交表單時(shí),LoginFormAuthenticator 將攔截請(qǐng)求,從表單中讀取電子郵件(或您正在使用的任何字段)和密碼,找到 User 對(duì)象,驗(yàn)證 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 }
查看完整描述

1 回答

?
繁花不似錦

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊

您似乎在樹枝表單上缺少 csrf_token 隱藏字段,如您提供的 Symfony 文檔鏈接中所述:如何構(gòu)建登錄表單

??<input?type="hidden"?name="_csrf_token"
???????????value="{{?csrf_token('authenticate')?}}"
????>

盡管我不推薦它,但如果您的應(yīng)用程序不重要,另一種解決方案是禁用 csrf_checking - 只需從 AuthAuthenticator 中刪除所有提及 CSRF 的內(nèi)容即可。


查看完整回答
反對(duì) 回復(fù) 2023-07-21
  • 1 回答
  • 0 關(guān)注
  • 139 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)