I have a User model, which has an admin_add function. The user's
password is being hashed just fine. I also have an admin_pw function,
with which an admin can change a user's password, and a change_pw
function, which lets the user change their own password. The Auth
component is not hashing passwords for the latter two functions. I
cannot see a difference in the views/functions and can't figure out
what is wrong. Does anyone have any ideas?

in app_controller:

function beforeFilter(){
       Security::setHash("md5");
        $this->Auth->model = 'User';
        $this->Auth->fields = array('username' => 'username',
'password' => 'password');
        $this->Auth->sessionKey = 'User';
        $this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
        $this->Auth->loginRedirect = array('controller' => 'profiles',
'action'=>'report_index');
        $this->Auth->logoutRedirect = null;
        $this->Auth->loginError = 'Invalid username / password
combination. Please try again';
        $this->Auth->authorize = 'controller';
        }

all three views use:
$form->password('User.password', array('size' => '30','label'=>false))

I do a straight $this->User->save($this->data) in all three functions,
but for the admin_pw and change_pw i need to do this first:
$this->data['User']['password'] = $this->Auth->password($this-
>data['User']['password']);
If i don't, the plain text password is saved to the db.

any ideas? thanks.
-d



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to