diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-12-12 12:07:09 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-12-12 12:07:09 +0000 |
commit | 72d0843c1fefedd44742a2d7e05ce46047d17b93 (patch) | |
tree | 84da338c024e8e06f2db7d73f5ae8ec32533589c /app/models/user.rb | |
parent | da98386bf748abde381c5681d70f9a5ea32fadee (diff) | |
download | redmine-72d0843c1fefedd44742a2d7e05ce46047d17b93.tar.gz redmine-72d0843c1fefedd44742a2d7e05ce46047d17b93.zip |
Makes User.find_by_mail case-insensitive (password reminder #2322, repo users mapping).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2122 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 3722081d2..ff46d9772 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -178,6 +178,11 @@ class User < ActiveRecord::Base token = Token.find_by_action_and_value('autologin', key) token && (token.created_on > Setting.autologin.to_i.day.ago) && token.user.active? ? token.user : nil end + + # Makes find_by_mail case-insensitive + def self.find_by_mail(mail) + find(:first, :conditions => ["LOWER(mail) = ?", mail.to_s.downcase]) + end # Sort users by their display names def <=>(user) |