The accepted answer is incomplete because it is still case sensitive when registering. For example, "username" and "USERNAME" can be successfully registered, but only the first can log in.
Disable case-insensitive keys in config/initializers/devise.rb (this may also be model specific, so check there):
config.case_insensitive_keys = []
Overwrite the find_first_by_auth_conditions models/user.rb :
def self.find_first_by_auth_conditions(warden_conditions) conditions = warden_conditions.dup if login = conditions.delete(:username) where(conditions).where(["lower(username) = :value", { :value => login.downcase }]).first else where(conditions).first end end
... and also set validates_uniqueness_of in models/user.rb :
validates_uniqueness_of :username, :case_sensitive => false
So, you have this: case-insensitive authentication, case-insensitive registration, which stores the case in the database.
source share