# 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