I'm trying to implement the Auth component for the first time into my
application. On my registration page I noticed that the password was
getting inserted into the database as plain text. The application
does not use the default names "username" and "password" so I defined
the fields as stated in the documentation.
app_controller:
function beforeFilter() {
// Configure Authuentication Component
$this->Auth->loginAction = array(
'controller' => 'users',
'action' => 'login'
);
$this->Auth->fields = array(
'username' => 'email',
'password' => 'passwd'
);
$this->Auth->authorize = 'controller';
$this->Auth->logoutRedirect = "/";
$this->Auth->loginError = 'Invalid email/password combination,
please try again.';
}
So in my "signup" code I added:
$this->data['User']['passwd'] = $this->Auth->password($this->data
['User']['passwd']);
to get the encrypted password put into the database, and that seems to
work. Next I proceed to the login page to test the new account
(standard login, cut and pasted code from documentation, but using my
email, and passwd fields). I then get my Auth->loginError, which I
believe is because the password is not getting encrypted
automatically.
I was under the impression that by using the $this->Auth->fields, that
the automagic would still work for me. Does the Auth->fields work as
intended?
Thanks,
Brian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---