zachinglis (owner)

Revisions

gist: 38436 Download_button fork
public
Public Clone URL: git://gist.github.com/38436.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
  def self.authenticate(login, password)
    return nil if login.blank? or password.blank?
    
    # need to get the salt
    if login.match("@")
      user = find_in_state :first, :active, :conditions => { :email => login}
    else
      user = find_in_state :first, :active, :conditions => { :login => login}
    end
    
    user && user.authenticated?(password) ? user : nil
  end