From bf769276b4696141bfd195ee9a71f9c30d1c1452 Mon Sep 17 00:00:00 2001 From: Boban Sugareski Date: Wed, 18 Sep 2024 10:33:13 +0200 Subject: [PATCH] Improve readability in #identity method of OmniAuth::Strategies::Identity --- lib/omniauth/strategies/identity.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/omniauth/strategies/identity.rb b/lib/omniauth/strategies/identity.rb index c6ea175..5113c14 100644 --- a/lib/omniauth/strategies/identity.rb +++ b/lib/omniauth/strategies/identity.rb @@ -104,12 +104,9 @@ def on_registration_path? end def identity - if options[:locate_conditions].is_a? Proc - conditions = instance_exec(request, &options[:locate_conditions]) - conditions.to_hash - else - conditions = options[:locate_conditions].to_hash - end + conditions = options[:locate_conditions] + conditions = conditions.is_a?(Proc) ? instance_exec(request, &conditions).to_hash : conditions.to_hash + @identity ||= model.authenticate(conditions, request['password']) end