[英]symfony-fosuserbundle No route found for “GET /login/” after removed hwi-oauthbundle
我搜索了許多stackoverflow頁面,並更新了源代碼以解決此問題。 但是我無法解決這個問題。 考慮到我錯過了代碼中的某些內容或更改了某些內容。
當我嘗試訪問“ /登錄”時。 它會自動重定向到“ / login /”
實際上,我的網站安裝了三個捆綁軟件。
刪除HWI oauth捆綁包后,出現此錯誤
找不到“ GET / login /”的路由(來自“ http://127.0.0.1:8000/ ”)
這是我在Symfony中的第一個項目。 任何人都可以給我您的更正和建議。 我已經提到
Config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: "@BlogBundle/Resources/config/services.yml" }
- { resource: "@UserBundle/Resources/config/services.yml" }
# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: fr
framework:
#Annotation enabled here
#validation: { enabled: true, enable_annotations: true }
#esi: ~
translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
fragments: ~
http_method_override: true
assets: ~
php_errors:
log: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
cache : false
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/../var/data/data.sqlite"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
#path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
# other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: UserBundle\Entity\User
from_email:
address: "test@myblog.org"
sender_name: "My-first-blog"
registration:
form:
type: UserBundle\Form\RegistrationType
easy_admin:
site_name: '<i class="fa fa-th" aria-hidden="true"></i> Hexagone - Espace Admin'
entities:
User:
label : Utilisateurs
class : UserBundle\Entity\User
list:
fields: ['username', 'email', 'enabled', 'last_login', 'roles','code_postal']
Projet :
class: BlogBundle\ProjetBundle\Entity\projet
label : Projets
design:
brand_color: '#333333'
使用routing.yml
projet:
resource: "@ProjetBundle/Resources/config/routing.yml"
prefix: /
blog_bundle_user:
resource: "@UserBundle/Resources/config/routing.yml"
prefix: /
blog:
resource: "@BlogBundle/Resources/config/routing.yml"
prefix: /
app:
resource: "@AppBundle/Controller/"
type: annotation
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
easy_admin_bundle:
resource: "@EasyAdminBundle/Controller/AdminController.php"
type: annotation
prefix: /backoffice
security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
login_path: /login
check_path: /login_check
default_target_path: /profile
# if you are using Symfony < 2.8, use the following config instead:
# csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
- { path: ^/backoffice, role: ROLE_ADMIN }
services.yml
服務:app.form.registration:類:UserBundle \\ Form \\ RegistrationType標簽:-{名稱:form.type,別名:app_user_registration}
所有路線
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_info ANY ANY ANY /_profiler/info/{about}
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
projet_homepage ANY ANY ANY /projet
blog_bundle_user_homepage ANY ANY ANY /
blog_homepage ANY ANY ANY /
githut ANY ANY ANY /
homepage ANY ANY ANY /
fos_user_security_login GET|POST ANY ANY /login
fos_user_security_check POST ANY ANY /login_check
fos_user_security_logout GET|POST ANY ANY /logout
fos_user_profile_show GET ANY ANY /profile/
fos_user_profile_edit GET|POST ANY ANY /profile/edit
fos_user_registration_register GET|POST ANY ANY /register/
fos_user_registration_check_email GET ANY ANY /register/check-email
fos_user_registration_confirm GET ANY ANY /register/confirm/{token}
fos_user_registration_confirmed GET ANY ANY /register/confirmed
fos_user_resetting_request GET ANY ANY /resetting/request
fos_user_resetting_send_email POST ANY ANY /resetting/send-email
fos_user_resetting_check_email GET ANY ANY /resetting/check-email
fos_user_resetting_reset GET|POST ANY ANY /resetting/reset/{token}
fos_user_change_password GET|POST ANY ANY /profile/change-password
easyadmin ANY ANY ANY /backoffice/
admin ANY ANY ANY /backoffice/
抱歉縮進,我粘貼代碼時可能會錯過。 需要什么來解決此問題? 我可以貼在這里。
注意:並且我也嘗試了我的舊版本,該版本不是hwi-oauth捆綁包。 它遇到了同樣的問題。
我再次瀏覽了fosbundle安裝頁面。 我沒有任何線索。
看起來您正在嘗試訪問應用程序中的路徑/login/
,但是只有定義為fos_user_security_login
的路由具有路徑/login
(沒有尾隨/
)。
這樣, RouteMatcher
不會匹配/login/
。 您還需要定義第二條路線以匹配此路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.