Recalculate pw hash whenever user is modified

This commit is contained in:
Andrew Brown 2013-03-04 02:06:26 -06:00
parent 5d8198b889
commit 39cd1dbc0f

View File

@ -8,6 +8,7 @@ class User
validates_uniqueness_of :name, :email
before_create :hash_password
before_save :hash_password
def hash_password
require 'digest'
self.password = Digest::MD5.hexdigest(self.name + "'s password IS... " + self.password + " (lol!)")