From 30a1aff5de67c664db903e11d3276faa6b5d030f Mon Sep 17 00:00:00 2001 From: Maicol Bentancor Date: Sun, 21 Jun 2020 21:52:43 -0300 Subject: [PATCH] Avoid nullyfing token when current_user is called before (#1417) --- app/controllers/devise_token_auth/concerns/set_user_by_token.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb index 027a9261a..52d3c1d00 100644 --- a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +++ b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb @@ -17,7 +17,7 @@ def set_request_start @used_auth_by_token = true # initialize instance variables - @token = DeviseTokenAuth::TokenFactory.new + @token ||= DeviseTokenAuth::TokenFactory.new @resource ||= nil @is_batch_request ||= nil end