News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mike Purcell's Blog:
Symfony - sfGuardPlugin - Use Email Instead of Username
August 15, 2011 @ 08:43:56

Mike Purcell has a handy new post for the Symfony users out there wanting more flexibility with their sfGuardPlugin use in their application. He describes how you can use email instead of a username for working with the user information.

sfGuardPlugin is pretty awesome. It allows a symfony developer the ability to quickly implement a user login and access control system. However, there is an issue with respect to telling the plugin whether to use the username or the email column for validating user submitted input. After some Googling I found a few sites which forced sfGuardPlugin to use email rather than username, but only after quite a bit of work. What I am going to show will accomplish the same end goal, but with minor changes.

He starts with a look at the validator class, showing how the values are going to be passed to the backend. The plugin makes a call to a "retrieveByUsername" method to get the user's information, but his method overrides this...sort of. His method actually contains the query to fetch the user information by email instead. This is useful if you want to use the email address as a username for the site but still want to maintain data integrity on the user records (valid emails can then be used for auth and for sending messages).

0 comments voice your opinion now!
sfguard symfony email username tutorial authentication


blog comments powered by Disqus

Similar Posts

Spindrop.us Blog: Easy Yahoo! Maps and GeoRSS with symfony

Lineke Kerckhoffs-Willems' Blog: How to use the Symfony2 SonataAdminBundle

Sameer Borate's Blog: Building a adjacency matrix of a graph

Geshan Manandhar: 3 Bundles to get started with REST in Symfony 2 and some tips

Zend: Zend Framework Database Access Webinar (Oct 31st, 2007)


Community Events





Don't see your event here?
Let us know!


series tips developer code podcast api introduction language deployment framework interview release conference community zendserver list application laravel development threedevsandamaybe

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework