lib/omniauth/strategies/multi_password.rb in omniauth-multipassword-0.1.1 vs lib/omniauth/strategies/multi_password.rb in omniauth-multipassword-0.2.0

- old
+ new

@@ -30,12 +30,13 @@ raise LoadError, "Could not find matching strategy for #{klass.inspect}." + "You may need to install an additional gem (such as omniauth-#{klass})." end end + args << block if block @authenticators ||= [] - @authenticators << [ klass, args, block ] + @authenticators << [ klass, args ] end def callback_phase username = request[username_id].to_s password = request[password_id].to_s @@ -47,30 +48,24 @@ end def authenticate(username, password) @authenticators.each do |auth| begin - if auth[2] - @authenticator = auth[0].new @app, *auth[1], auth[2] - else - @authenticator = auth[0].new @app, *auth[1] - end - @authenticator.request = self.request + @authenticator = auth[0].new @app, *auth[1] + @authenticator.init_authenticator(@request, @env, username) return true if @authenticator.authenticate(username, password) rescue Error => e OmniAuth.logger.warn "OmniAuth ERR >>> " + e end @authenticator = nil end false end info do - if @authenticator and @authenticator.info.is_a?(Hash) - @authenticator.info - else - {} - end + info = @authenticator.info if @authenticator + info = {} unless info.is_a?(Hash) + info end end end end