Re: I want to change password using cake php

2013-01-02 Thread Paulo Braga
Ok, you want to change a password in cake.

you have to have somthing like this:

old password: _
new password: 
confirm new password:

right??

so first you have to make a method in UsersController called 
changePassword(){}
and a view in foldes Users called change_password.ctp

in the change password you have to put:

  public function changePassword($id = null) { 
if ($this->data) { 
if ($this->User->save($this->data)) 
$this->Session->setFlash('Password changed successfully'); 
else
$this->Session->setFlash('The password was not changed'); 
} else { 
$this->data = $this->User->read(null, $id); 
} 
}

in change_password.ctp:

Form->create();?> 
Form->input('id');?> 
Form->input('current_password',array('type'=>'password'));?> 
Form->input('password',array('label'=>'New 
password','value'=>''));?> 
Form->input('password_confirmation',array('label'=>'confirm your 
password','type'=>'password', 'value'=>''));?> 
Form->end('change');?>

in User model put:

public $validate = array( 
 
'password' => array( 
'Not empty' => array( 
'rule' => 'notEmpty', 'message' => 'please enter your 
password' 
), 
'Match passwords' => array( 
'rule' => 'matchPasswords', 
'message' => 'your passwords do not match' 
) 
), 
'password_confirmation' => array( 
'Not empty' => array( 
'rule' => 'notEmpty', 'message' => 'please confirm your 
password' 
) 
), 
'current_password' => array( 
'notempty' => array('rule' => 'notEmpty', 'message' => 'please 
enter your old password'), 
'check password' => array('rule' => 'checkPassword', 
'message' => 'your password is not correct') 
)
);

public function matchPasswords($data) { 
if ($data['password'] == 
$this->data['User']['password_confirmation']) 
return true; 
$this->invalidate('password_confirmation', 'your passwords do not 
match'); 
return false; 
} 
 
public function checkPassword($data) { 
$user1=new User(); 
$user=$user1->read(null,  $this->data['User']['id']); 

$current_password=AuthComponent::password($data['current_password']); 
if($current_password==$user['User']['password']){ 
return true; 
 
} 
return false; 
 
}



On Tuesday, December 25, 2012 4:24:10 PM UTC+2, sweety wrote:
>
>
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-27 Thread Jeremy Burns : Class Outfit
Start here like we all did 
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
 then you won't be so new.


Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 27 Dec 2012, at 05:34, sweety  wrote:

> how to hash?
> 
> i am new to cakephp 
> 
> 
> On Wednesday, December 26, 2012 10:11:26 AM UTC-5, euromark wrote:
> just follow the documentation:
> http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords
> 
> you might also want to read
> http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp/
> 
> use an alias field, hash and store the password. thats all there is to it.
> 
> -- 
> 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 post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to 
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>  
>  

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-27 Thread sweety
how to hash?

i am new to cakephp 


On Wednesday, December 26, 2012 10:11:26 AM UTC-5, euromark wrote:
>
> just follow the documentation:
>
> http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords
>
> you might also want to read
> http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp/
>
> use an alias field, hash and store the password. thats all there is to it.
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-26 Thread euromark
just follow the documentation:
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#hashing-passwords

you might also want to read
http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp/

use an alias field, hash and store the password. thats all there is to it.

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-26 Thread Jonathan Sundquist
You should never modify the database manually. You should have cakephp
update the database for you.
On Dec 26, 2012 1:15 AM, "crush"  wrote:

> Turn debug to 2 in the config file. Login with the new password and copy
> the password string it posts in the debug at the bottom of the page after
> you try to login. Paste that into the database in the password field for
> the appropriate user.
>
> --
> 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 post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-25 Thread crush
Turn debug to 2 in the config file. Login with the new password and copy 
the password string it posts in the debug at the bottom of the page after 
you try to login. Paste that into the database in the password field for 
the appropriate user.

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-25 Thread Jonathan Sundquist
You can update it the same way you created it.
On Dec 25, 2012 7:11 PM, "euromark"  wrote:

> did you try google?
>
>
> Am Dienstag, 25. Dezember 2012 15:24:10 UTC+1 schrieb sweety:
>>
>>
>>  --
> 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 post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-25 Thread euromark
did you try google?


Am Dienstag, 25. Dezember 2012 15:24:10 UTC+1 schrieb sweety:
>
>
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: I want to change password using cake php

2012-12-25 Thread Jonathan Sundquist
That's nice.
On Dec 25, 2012 7:07 PM, "sweety"  wrote:

>
>  --
> 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 post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.