Or if you don't want to analyze the format of the 'username' field,
you could create a method (perhaps under the User model) that attempts
to log in first using username, then tries with email if that doesn't
work.

On May 31, 8:23 am, John Andersen <[email protected]> wrote:
> The same issue has been discussed in this 
> thread:http://groups.google.com/group/cake-php/browse_thread/thread/728bd1da...
>
> See how the original poster did it, you should be able to do something
> similar.
> Enjoy,
>    John
>
> On May 31, 1:56 pm, Saurav <[email protected]> wrote:
>
> > Hi
>
> > I am using the following code to authenticate a user:
>
> > function beforeFilter() {
> >                 $this->Auth->fields = array('username' => 'email',
> > 'password' => 'password');
>
> >         }
>
> > Its working fine!  But, I want cakephp to validate the auth with
> > username = 'email' OR username = 'username'
>
> > I tried the following but its not working:
>
> > function beforeFilter() {
> >                 $this->Auth->fields = array('username' =>
> > array('email','username'), 'password' => 'password');
>
> >         }
>
> > Can anyone help me with this pls?
>
> > Many Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to