0
我已經按照官方文檔中的所有步驟在我的項目中安裝了FOSUserBundle,但登錄無效。 當我在登錄表單中提交時,它會回到登錄頁面。沒有錯誤,沒有通知,什麼都沒有。FOSUserBundle登錄系統無所作爲
我的代碼:
security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/.*
anonymous: true
form_login:
login_path: /login
check_path: /login_check
provider: fos_userbundle
login:
pattern: ^/login$
security: false
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login_check, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, roles: ROLE_USER }
config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: Cdp\CoreBundle\Entity\BackendUser
用戶類
namespace Cdp\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="backend_users")
*/
class BackendUser extends BaseUser {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct() {
parent::__construct();
}
}
的routing.yml
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
親切的問候, Jesús。
PHP日誌中的任何錯誤?在Symfony prod/dev日誌中? – NaeiKinDus
我在php日誌和Symfony日誌中看不到任何錯誤。 –
你已經將該包添加到'app/AppKernel.php'? – giorgio