Or a more clean way would be to change it on the beforeSave() of the model.
And then if you build queries to find the user using user / password, just
set a findByUserAndPassword method on the model where you take the plain
password as parameter, and hash it before doing the find.

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar

-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Langdon Stevenson
Enviado el: MiƩrcoles, 28 de Febrero de 2007 06:52 p.m.
Para: [email protected]
Asunto: Re: newbie: register user

Instead of setting

   $this->data['User']['password'] = hash('sha256',$salt.$user.$pass);

Why not do this:

   $newUser = $this->data['User'];
   $newUser['password'] = hash('sha256',$salt.$user.$pass);

   if($this->User->save($newUser)) { ...

That way the original data is unchanged.  Or you could just set the 
password to null if the save fails.  Meaning that the user has to 
re-enter the password, which seems to be a fairly typical way of doing 
things.  It also reduces the number of times that the password is 
whizzing around on the Internet.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to