Skip to content

Commit fec2e75

Browse files
committed
Make email case insensitive on authentication
1 parent bcd11ac commit fec2e75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/models/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def has_password?(submitted_password)
125125

126126
def self.authenticate(login, submitted_password)
127127
user = find_by(login: login)
128-
user = find_by(email: login) if user.nil?
128+
user = find_by('lower(email) = ?', login.downcase) unless user
129129
return nil if user.nil?
130130
return user if user.has_password?(submitted_password)
131131
end

0 commit comments

Comments
 (0)