简体   繁体   中英

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

I am using Symfony 1.4 and ORM as Propel in my project. I have configured the Settings.yml to secure my page. 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.

Easiest way to override the view of sfGuard signin:

1) Create a directory called 'sfGuardAuth' in your frontend module:

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

2) Copy the default templates from the sfGuardPlugin folder to the new module

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

3) Edit the new files to your hearts content

4) Clear cache

./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();

then in the view you can do whatever you'd like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM