I use a password_confirm, have setup the validations in the model to
check password == password_confirm and have this function in my user
model:
function beforeSave() {
if (!isset($this->data['User']['password_confirm']) ||
empty($this->data['User']['password_confirm'])) {
unset($this->data['User']['password']);
}
return true;
}
So, you don't save passwords if there isn't confirmation, and
confirmation == password is enforced at validation code.
Here is my complete user model: http://bin.cakephp.org/view/1208127933
Regards,
- Dardo Sordi.
On Fri, Jun 6, 2008 at 9:13 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> Why not just remove the password field from the form and create a
> dedicated action/view for changing a password? Works for me.
>
> On Fri, Jun 6, 2008 at 5:15 PM, benjam <[EMAIL PROTECTED]> wrote:
>>
>> I don't think beforeSave would work, because it gets hashed even
>> before the method that calls Save( ).
>>
>> I think I may have found a cheater (read: non-cake) way of doing it...
>>
>> I run the following test:
>>
>> if ($this->Auth->password('') == $this->data['User']['password']) {
>> unset($this->data['User']['password']);
>> }
>>
>> Basically, if the hash matches the hash of an empty string, the
>> password was empty... clear it. done.
>>
>> thanks for all the input though guys, I appreciate it.
>> >
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---