User and Password
Hello When I add a user in the database the password is cryped public function beforeSave($options = array()) { $this-data['User']['password'] = AuthComponent::password($this-data['User']['password']); return true; } But if I edit the user to change the email adresse for example the password is cryped again so it crypted an already cryped password. How can I avoid that. Thanks for your help -- Like Us on FacekBook 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: User and Password
use an alias in the forms http://www.dereuromark.de/2011/08/25/working-with-passwords-in-cakephp/ Am Donnerstag, 4. Oktober 2012 17:42:15 UTC+2 schrieb cosinusweb: Hello When I add a user in the database the password is cryped public function beforeSave($options = array()) { $this-data['User']['password'] = AuthComponent::password($this-data['User']['password']); return true; } But if I edit the user to change the email adresse for example the password is cryped again so it crypted an already cryped password. How can I avoid that. Thanks for your help -- Like Us on FacekBook 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: User and Password
You can create multiple validation rules in your model and choose different rule depending on what page or case scenario you need to apply. On Oct 4, 2012, at 8:42 AM, cosinusweb cosinus...@gmail.com wrote: Hello When I add a user in the database the password is cryped public function beforeSave($options = array()) { $this-data['User']['password'] = AuthComponent::password($this-data['User']['password']); return true; } But if I edit the user to change the email adresse for example the password is cryped again so it crypted an already cryped password. How can I avoid that. Thanks for your help -- Like Us on FacekBook 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 FacekBook 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.
Auth Component - Edit User blank password
Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save():http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4... On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
you're welcome in addition, it's always a good practice to specify which fileds to update in each Model-save() call it will prevent POST forgery On 14 jan, 12:37, Mike Digital Egg [EMAIL PROTECTED] wrote: Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save():http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4... On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
and better, use the security component, it will secure your forms very well but it's another topic On 14 jan, 14:03, djiize [EMAIL PROTECTED] wrote: you're welcome in addition, it's always a good practice to specify which fileds to update in each Model-save() call it will prevent POST forgery On 14 jan, 12:37, Mike Digital Egg [EMAIL PROTECTED] wrote: Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save():http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4... On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
I'm confused... So what if they do want to edit the password? Do you check $this-data before save and populate the fileds array in save() conditionally? I guess my real question is why not just don't put the password field on the form. On Jan 14, 2008 7:04 AM, djiize [EMAIL PROTECTED] wrote: and better, use the security component, it will secure your forms very well but it's another topic On 14 jan, 14:03, djiize [EMAIL PROTECTED] wrote: you're welcome in addition, it's always a good practice to specify which fileds to update in each Model-save() call it will prevent POST forgery On 14 jan, 12:37, Mike Digital Egg [EMAIL PROTECTED] wrote: Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save(): http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4... On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
I use 2 ways, it depends of project, design, ... : 1- 2 forms : 1 for passowrd change, and 1 for other fields. So the $fieldList save are fixed 2- 1 form to rule them all. I test if password is set, and set $fieldList accordingly On 14 jan, 15:07, Baz [EMAIL PROTECTED] wrote: I'm confused... So what if they do want to edit the password? Do you check $this-data before save and populate the fileds array in save() conditionally? I guess my real question is why not just don't put the password field on the form. On Jan 14, 2008 7:04 AM, djiize [EMAIL PROTECTED] wrote: and better, use the security component, it will secure your forms very well but it's another topic On 14 jan, 14:03, djiize [EMAIL PROTECTED] wrote: you're welcome in addition, it's always a good practice to specify which fileds to update in each Model-save() call it will prevent POST forgery On 14 jan, 12:37, Mike Digital Egg [EMAIL PROTECTED] wrote: Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save(): http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4... On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
Oooohh, gotcha. Interesting. What I usually do is have another field like chng_pass...and if that is set, I'd set password = chgn_pass. -- Kevin Lloyd 3HN Designs http://www.3HNDesigns.com/ (214) 473-4207 On 1/14/08, djiize [EMAIL PROTECTED] wrote: I use 2 ways, it depends of project, design, ... : 1- 2 forms : 1 for passowrd change, and 1 for other fields. So the $fieldList save are fixed 2- 1 form to rule them all. I test if password is set, and set $fieldList accordingly On 14 jan, 15:07, Baz [EMAIL PROTECTED] wrote: I'm confused... So what if they do want to edit the password? Do you check $this-data before save and populate the fileds array in save() conditionally? I guess my real question is why not just don't put the password field on the form. On Jan 14, 2008 7:04 AM, djiize [EMAIL PROTECTED] wrote: and better, use the security component, it will secure your forms very well but it's another topic On 14 jan, 14:03, djiize [EMAIL PROTECTED] wrote: you're welcome in addition, it's always a good practice to specify which fileds to update in each Model-save() call it will prevent POST forgery On 14 jan, 12:37, Mike Digital Egg [EMAIL PROTECTED] wrote: Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save(): http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4. .. On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
Interesting too, didn't think about this way. Maybe one workaround, you may have to hash the password yourself, instead of Auth auto hash it On 14 jan, 15:42, Baz [EMAIL PROTECTED] wrote: Oooohh, gotcha. Interesting. What I usually do is have another field like chng_pass...and if that is set, I'd set password = chgn_pass. -- Kevin Lloyd 3HN Designshttp://www.3HNDesigns.com/ (214) 473-4207 On 1/14/08, djiize [EMAIL PROTECTED] wrote: I use 2 ways, it depends of project, design, ... : 1- 2 forms : 1 for passowrd change, and 1 for other fields. So the $fieldList save are fixed 2- 1 form to rule them all. I test if password is set, and set $fieldList accordingly On 14 jan, 15:07, Baz [EMAIL PROTECTED] wrote: I'm confused... So what if they do want to edit the password? Do you check $this-data before save and populate the fileds array in save() conditionally? I guess my real question is why not just don't put the password field on the form. On Jan 14, 2008 7:04 AM, djiize [EMAIL PROTECTED] wrote: and better, use the security component, it will secure your forms very well but it's another topic On 14 jan, 14:03, djiize [EMAIL PROTECTED] wrote: you're welcome in addition, it's always a good practice to specify which fileds to update in each Model-save() call it will prevent POST forgery On 14 jan, 12:37, Mike Digital Egg [EMAIL PROTECTED] wrote: Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save(): http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4. .. On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Auth Component - Edit User blank password
True, But I need it like that anyways, because I do some validation (length, sames as confirm field). On Jan 14, 2008 9:35 AM, djiize [EMAIL PROTECTED] wrote: Interesting too, didn't think about this way. Maybe one workaround, you may have to hash the password yourself, instead of Auth auto hash it On 14 jan, 15:42, Baz [EMAIL PROTECTED] wrote: Oooohh, gotcha. Interesting. What I usually do is have another field like chng_pass...and if that is set, I'd set password = chgn_pass. -- Kevin Lloyd 3HN Designshttp://www.3HNDesigns.com/ (214) 473-4207 On 1/14/08, djiize [EMAIL PROTECTED] wrote: I use 2 ways, it depends of project, design, ... : 1- 2 forms : 1 for passowrd change, and 1 for other fields. So the $fieldList save are fixed 2- 1 form to rule them all. I test if password is set, and set $fieldList accordingly On 14 jan, 15:07, Baz [EMAIL PROTECTED] wrote: I'm confused... So what if they do want to edit the password? Do you check $this-data before save and populate the fileds array in save() conditionally? I guess my real question is why not just don't put the password field on the form. On Jan 14, 2008 7:04 AM, djiize [EMAIL PROTECTED] wrote: and better, use the security component, it will secure your forms very well but it's another topic On 14 jan, 14:03, djiize [EMAIL PROTECTED] wrote: you're welcome in addition, it's always a good practice to specify which fileds to update in each Model-save() call it will prevent POST forgery On 14 jan, 12:37, Mike Digital Egg [EMAIL PROTECTED] wrote: Hey djiize , that worked great, thanks :) Mike On Jan 14, 11:39 am, djiize [EMAIL PROTECTED] wrote: you can speciify which fields to update with the 3rd parameter of Model-save(): http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4. .. On 14 jan, 11:03, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am using the Auth component for 1.2 and it is all working fine except when I go to edit a user I want to have the option to leave the password field blank and have itleave the password unchanged. Whenever I do this it rehashes the password using '' as the password. I have tried using unset( $this-data['User']['password'] ); so that the password field is not added to the query but it does not work. Any ideas how I would do this? Thanks Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---