-
-
Save mokolabs/992442 to your computer and use it in GitHub Desktop.
If you need to support logging in via username and your usernames are case sensitive, use this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.authenticate(email, password) | |
user = find(:first, :conditions => ['LOWER(username) = ? OR email = ?', email.to_s.downcase, email.to_s.downcase]) | |
user && user.authenticated?(password) ? user : nil | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment