Re: Auth Problem Again..
I just followed the recipe from scratch and found no issues. I am able
to log in with either a user account, or an email. Can you set DEBUG
to 2 (in your app/config/core.php file) and paste the queries that are
shown?
On Apr 11, 5:42 pm, john lyles <confidentia...@gmail.com> wrote:
> Hi Everyone,
> I am following a recipe from 'Cakephp 1.3 Application Development
> Cookbook' ByMarianoIglesiasand I am stuck with the recipe 'Allowing
> logins with username or email' on page 16 of the book.
>
> The recipe works except one problem which I cannot figure out. If I
> login with the email instead of the username the loginError message
> flashes on the screen. This doesn't happen if I login using the
> username.
>
> I should note also that you have to do the basic auth setup before you
> can do this recipe, and the basic setup works with no issues that I
> have noticed so far.
>
> This is what the login action of the Users Controller looks like:
>
> public function login() {
> if (
> !empty($this->data) &&
> !empty($this->Auth->data['User']['username']) &&
> !empty($this->Auth->data['User']['password'])
> ) {
> $user = $this->User->find(
> 'first', array(
> 'conditions' => array(
> 'User.email' => $this->Auth->data['User']['username'],
> 'User.password' => $this->Auth->data['User']['password']
> ),
> 'recursive' => -1
> ));
> if (!empty($user) && $this->Auth->login($user)) {
> if ($this->Auth->autoRedirect) {
> $this->redirect($this->Auth->redirect());
> }
> } else {
> $this->Session->setFlash($this->Auth->loginError, $this->Auth-
>
>
>
>
>
>
>
> >flashElement, array(), 'auth');
> }
> }
> }
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home