Hi everyone,
I started to learn CakePHP recently and followed the ACL tutorial step
by step, trying to understand every single piece of it.
Sadly, I couldn't achieve it correctly since my app doesn't work.
Indeed, I can't log in. Every time, it says that my user name or
password is incorrect (while it should be correct).
I don't login with "User.username" and "User.password" but with
"User.email_address" and "User.password". Therefore my AppController:
public $components = array(
'Acl',
'Auth' => array(
'authorize' => array(
'Actions' => array('actionPath' =>
'controllers')
),
'authentificate' => array(
'Form' => array(
'username' => 'email_address',
'password' => 'password'
)
)
),
'Session'
);
And in my UsersController:
public function login() {
if ($this->Session->read('Auth.User')) {
$this->Session->setFlash('You are logged in!');
$this->redirect('/', null, false);
}
if ($this->request->is('post')) {
if ($this->Auth->login())
$this->redirect($this->Auth->redirect());
else $this->Session->setFlash('Your email address or
password was
incorrect.');
}
}
I'm being careful and my password is encrypted in MD5 in my User model
public function beforeSave() {
$this->data['User']['password'] = AuthComponent::password($this-
>data['User']['password']);
return true;
}
If always ends in "Your email address or password was incorrect." and
I can't figure out what I did wrong.
It's frustrating, I find the tutorial very abstruse on some important
points as I'd like to understand how it works.
Thank you in advance for your help.
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php