mitkok (owner)

Fork Of

Revisions

gist: 44836 Download_button fork
public
Public Clone URL: git://gist.github.com/44836.git
Embed All Files: show embed
user.rb #
1
2
3
4
5
6
7
8
9
# Username or email login for restful_authentication in user.rb model
  def self.authenticate(login, password)
    return nil if login.blank? || password.blank?
    u = find_in_state :first, :active, :conditions => ["email = ? OR login = ?",login,login] # need to get the salt
    u && u.authenticated?(password) ? u : nil
  end