Hi all,
Funny, was discussing this only yesterday with someone.
A snippet of code that will ensure that you don't md5 the md5 of your
password, and keep the logic in the model.
// Stick this in bootstrap
define('VALID_MD5', '/^[a-fA-F0-9]{32}$/i');
<?php
class Member extends AppModel
{
var $name = "Member";
function beforeSave()
{
$password =
isset($this->data['Member']['password'])?$this->data['Member']['password']:"";
if (!preg_match(VALID_MD5, $password))
{
$this->data['Member']['password'] = md5($password);
}
return true;
}
}
?>
Cheers,
AD7six
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---