Tuesday, April 2, 2013

Re: Auth Component Issues

Hi Ramon, actually it´s not a issue, you said you´re not using a password hash, but the Auth system always use one to retrieve the user information, so when you try to use $this->Auth->login() it hashes the password before find on table, so you should hash it with AuthComponent::password() at model´s beforeSave to save the correct password on table...

Em segunda-feira, 1 de abril de 2013 16h55min32s UTC-3, Ramon José Silva escreveu:
Hi guys.

Well, I trying to use the CakePHP on my own project, but I have a problem with the Auth Component.

I'm not using the password hash yet and not using the UsersController and User Model, but I using Admin Model, AdminController and an Ajax, passing the form data to the controller login method, but I can't login in my system, the Auth always return false. I read the Docs trying to find something that's help me, and saw in the Auth part that I can personalized my form fields and tables to passing the data and everything works fine, but it not work for me.

If I use:

$this->data = array() and passing all data that I receive with Ajax to my Auth login, the login works fine, but not check if the User are subscribed on my DB. In the Docs have something about that, but with I try to login with the e-mail address and password that I registered, the Auth always return false even my User really exists in my DB.

This is my AdminController: http://pastebin.com/AvQQf6iw

This is my App Controller: http://pastebin.com/B5XBwR5g


Now, if I use in my login method this line: 

$query = $this->Admin->find('first', array('conditions' => array('admin_email' => $this->data['admin_email'], 'admin_pass' => $this->data['admin_pass'])));

if($query == true){
  echo 'true'; 
} else {
  echo 'Wrong User/Password';
}

I really find the user.

Can anyone help me with this?

Thanks Guys for the help anyway.



--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: