diff --git a/lib/authlogic/acts_as_authentic/login.rb b/lib/authlogic/acts_as_authentic/login.rb index 7ea87a13..d70ca06a 100644 --- a/lib/authlogic/acts_as_authentic/login.rb +++ b/lib/authlogic/acts_as_authentic/login.rb @@ -94,7 +94,7 @@ def merge_validates_uniqueness_of_login_field_options(options = {}) # manner that they handle that. If you are using the login field and set false for the :case_sensitive option in # validates_uniqueness_of_login_field_options this method will modify the query to look something like: # - # where("#{quoted_table_name}.#{field} LIKE ?", login).first + # where("LOWER(#{quoted_table_name}.#{login_field}) = ?", login.downcase).first # # If you don't specify this it calls the good old find_by_* method: # @@ -118,8 +118,7 @@ def find_with_case(field, value, sensitivity = true) if sensitivity send("find_by_#{field}", value) else - like_word = ::ActiveRecord::Base.connection.adapter_name == "PostgreSQL" ? "ILIKE" : "LIKE" - where("#{quoted_table_name}.#{field} #{like_word} ?", value.mb_chars).first + where("LOWER(#{quoted_table_name}.#{field}) = ?", value.mb_chars.downcase).first end end end