I almost forgot

In the model User, use a method beforeSave to crypt the password.

Em terça-feira, 28 de maio de 2013 14h37min41s UTC-3, André Luis escreveu:
>
> echo $this->Form->create('User');
> echo $this->Form->input('password');
> echo $this->Form->input('password_retype');
> echo $this->Form->end('Send data');
>
> And in controller:
>
> public function change_password(){
>         if($this->request->is('post') || $this->request->is('put')){
>             if(!empty($this->request->data['User']['password']) && 
> !empty($this->request->data['User']['password_retype'])){
>                 if($this->request->data['User']['password'] == 
> $this->request->data['User']['password_retype']){
>                     $this->User->id=$this->Auth->user('id');
>                     if($this->User->save($this->request->data)){
>                         $this->Session->setFlash('Your password has been 
> changed');
>                     } else {
>                         $this->Session->setFlash('Could not change your 
> password due a server problem, try again latter');
>                     }
>                 } else {
>                     $this->Session->setFlash('Your password and your 
> retype must match');
>                 }
>             } else {
>                 $this->Session->setFlash('Password or retype not sent');
>             }
>         }
>     }
>
>
> It´s something like this
>
> Em sábado, 25 de maio de 2013 14h23min47s UTC-3, Igor Borovica escreveu:
>>
>> Can someone help me with change password function in cakephp?
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to