Tuesday, June 1, 2010

Re: CakePHP - Auth

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 <j.andersen...@gmail.com> 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 <cance...@gmail.com> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: