Search: try to match the email address too.

This commit is contained in:
Philippe Pittoli 2024-02-17 18:13:12 +01:00
parent 494b0b3719
commit 4a10456f27

View File

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