lib/casserver/authenticators/sql_encrypted.rb in gunark-rubycas-server-0.8.0.20090227 vs lib/casserver/authenticators/sql_encrypted.rb in gunark-rubycas-server-0.8.0.20090427
- old
+ new
@@ -54,9 +54,10 @@
raise "#{self} should be inclued in an ActiveRecord class!" unless mod.respond_to?(:before_save)
mod.before_save :generate_encryption_salt
end
def encrypt(str)
+ generate_encryption_salt unless encryption_salt
Digest::SHA256.hexdigest("#{encryption_salt}::#{str}")
end
def password=(password)
self[:encrypted_password] = encrypt(password)
\ No newline at end of file