Skip to content

Commit

Permalink
Use more efficient account lookup query for LDAP logins
Browse files Browse the repository at this point in the history
Co-authored-by: Claire <[email protected]>
  • Loading branch information
raucao and ClearlyClaire committed Apr 30, 2024
1 parent 450fa55 commit a4eea02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/concerns/user/ldap_authenticable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def ldap_get_user(attributes = {})
safe_username = safe_username.gsub(keys, replacement)
end

resource = joins(:account).find_by('accounts.username ILIKE ?', safe_username)
resource = joins(:account).merge(Account.where(Account.arel_table[:username].lower.eq safe_username.downcase)).take

if resource.blank?
resource = new(
Expand Down

0 comments on commit a4eea02

Please sign in to comment.