Search: try to match the email address too.

master
Philippe Pittoli 2024-02-17 18:13:12 +01:00
parent 494b0b3719
commit 4a10456f27
1 changed files with 8 additions and 6 deletions

View File

@ -22,13 +22,15 @@ class AuthD::Request
pattern = Regex.new regex, Regex::Options::IGNORE_CASE pattern = Regex.new regex, Regex::Options::IGNORE_CASE
users.each do |u| users.each do |u|
if pattern =~ u.login || u.profile.try do |profile| if pattern =~ u.login || u.profile.try do |profile|
full_name = profile["full_name"]? full_name = profile["full_name"]?
if full_name.nil? if full_name.nil?
false false
else else
pattern =~ full_name.as_s pattern =~ full_name.as_s
end
end || u.contact.email.try do |email|
pattern =~ email
end end
end
Baguette::Log.debug "#{u.login} matches #{pattern}" Baguette::Log.debug "#{u.login} matches #{pattern}"
matching_users << u.to_public matching_users << u.to_public
else else