From 0d9bc8da0eb8cc1eb993ada615505f48b1e729be Mon Sep 17 00:00:00 2001 From: Philipp Staender Date: Sat, 18 Mar 2017 11:00:48 +0100 Subject: [PATCH] Check and use if newer bypass_sign_in method exists in devise --- app/controllers/devise/two_factor_authentication_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/devise/two_factor_authentication_controller.rb b/app/controllers/devise/two_factor_authentication_controller.rb index cf9bd6e..2cd8d6f 100644 --- a/app/controllers/devise/two_factor_authentication_controller.rb +++ b/app/controllers/devise/two_factor_authentication_controller.rb @@ -30,7 +30,7 @@ class Devise::TwoFactorAuthenticationController < DeviseController warden.session(resource_name)[TwoFactorAuthentication::NEED_AUTHENTICATION] = false # For compatability with devise versions below v4.2.0 # https://github.com/plataformatec/devise/commit/2044fffa25d781fcbaf090e7728b48b65c854ccb - if Devise::VERSION.to_f >= 4.2 + if respond_to?(:bypass_sign_in) bypass_sign_in(resource, scope: resource_name) else sign_in(resource_name, resource, bypass: true)