[英]How to create a custom login for sfGuard user in Symfony?
I am using Symfony 1.4 and ORM as Propel in my project. 我在我的项目中使用Symfony 1.4和ORM作为Propel。 I have configured the Settings.yml to secure my page.
我已经配置了Settings.yml来保护我的页面。 But can i make a custom login/logout by my action extending all the SfGuard plugins functionality.i found one article in SymfonyLab , but was not clear enough.
但是我可以通过扩展所有functionality.i发现一个文章中的SfGuard插件我的行动使自定义登录/注销SymfonyLab ,但还不够清楚。
Easiest way to override the view of sfGuard signin: 覆盖sfGuard登录视图的最简单方法:
1) Create a directory called 'sfGuardAuth' in your frontend module: 1)在前端模块中创建一个名为'sfGuardAuth'的目录:
mkdir apps/frontend/modules/sfGuardAuth
mkdir apps/frontend/modules/sfGuardAuth/templates
2) Copy the default templates from the sfGuardPlugin folder to the new module 2)将默认模板从sfGuardPlugin文件夹复制到新模块
cp plugins/sfGuardPlugin/modules/sfGuardAuth/templates/* apps/frontend/modules/sfGuardAuth/templates
3) Edit the new files to your hearts content 3)将新文件编辑为您的内容
4) Clear cache 4)清除缓存
./symfony cc
You can also display the login form wherever you want. 您还可以在任何地方显示登录表单。 I have a page for users to register or login, so I did something like:
我有一个页面供用户注册或登录,所以我做了类似的事情:
$this->signin = new sfGuardFormSignin();
$ this-> signin = new sfGuardFormSignin();
then in the view you can do whatever you'd like. 然后在视图中你可以做任何你想做的事。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.