Displaying 1 result from an estimated 1 matches for "sha_password".
Did you mean:
s_password
2006 Mar 02
8
User Authentication
...tr_accessor :password
attr_accessible :username, :password, :first_name, :last_name, :email
validates_uniqueness_of :username
validates_presence_of :username, :first_name, :last_name, :email
validates_length_of :password, :within => 5..40, :on => :create
def before_create
self.sha_password = User.encrypt(self.password)
end
def after_create
@password = nil
end
private
def self.encrypt(password)
Digest::SHA1.hexdigest(password)
end
def self.login_user(username, password)
encrypted_password = encrypt(password || "")
find(:first, :conditions =&g...