/ Published in: Rails

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def self.authenticate(email, password) user = find(:first, :conditions => ['email = ?', email]) unless user.blank? if user.password_hash.nil? or Digest::SHA256.hexdigest(password + user.password_salt) == user.password_hash user.update_attributes(:last_login => Time.now.to_s(:db)) user else raise AuthenticationError, "Invalid email and/or password" end else raise AuthenticationError, "Invalid email and/or password" end end
Comments
