簡體   English   中英

如何在Symfony中為sfGuard用戶創建自定義登錄?

[英]How to create a custom login for sfGuard user in Symfony?

我在我的項目中使用Symfony 1.4和ORM作為Propel。 我已經配置了Settings.yml來保護我的頁面。 但是我可以通過擴展所有functionality.i發現一個文章中的SfGuard插件我的行動使自定義登錄/注銷SymfonyLab ,但還不夠清楚。

覆蓋sfGuard登錄視圖的最簡單方法:

1)在前端模塊中創建一個名為'sfGuardAuth'的目錄:

mkdir apps/frontend/modules/sfGuardAuth
mkdir apps/frontend/modules/sfGuardAuth/templates

2)將默認模板從sfGuardPlugin文件夾復制到新模塊

cp plugins/sfGuardPlugin/modules/sfGuardAuth/templates/* apps/frontend/modules/sfGuardAuth/templates

3)將新文件編輯為您的內容

4)清除緩存

./symfony cc

您還可以在任何地方顯示登錄表單。 我有一個頁面供用戶注冊或登錄,所以我做了類似的事情:

$ this-> signin = new sfGuardFormSignin();

然后在視圖中你可以做任何你想做的事。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM