Password Hash Implementation

Posted by oyerli on Stack Overflow See other posts from Stack Overflow or by oyerli
Published on 2010-05-14T21:55:12Z Indexed on 2010/05/14 22:44 UTC
Read the original article Hit count: 162

Filed under:
|

I am developing a new application using Symfony. I want to store the passwords hashed, so I overridded the save method in my User model:

public function save(Doctrine_Connection $conn = null)
{
    $this->setUserPassword( md5($this->getUserPassword()) );
return parent::save($conn);
}

This works good when a new user created. However, this causes problems when we edit a user without changing his password. This causes Doctrine to hash the already hashed password.

So, I need to check that whether the UserPassword is modified in this DoctrineRecord instance. How can I manage to do that?

© Stack Overflow or respective owner

Related posts about symfony

Related posts about doctrine