From 2627e7bf33de86b0f0c758ff89a04dffdf459112 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Fri, 20 Mar 2020 15:31:48 -0300 Subject: [PATCH] Fix: Save user authentication token after email confirmation --- app/controllers/devise_token_auth/confirmations_controller.rb | 1 + .../devise_token_auth/confirmations_controller_test.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/devise_token_auth/confirmations_controller.rb b/app/controllers/devise_token_auth/confirmations_controller.rb index c1a0ba6c7..aa17e8af6 100644 --- a/app/controllers/devise_token_auth/confirmations_controller.rb +++ b/app/controllers/devise_token_auth/confirmations_controller.rb @@ -13,6 +13,7 @@ def show if signed_in?(resource_name) token = signed_in_resource.create_token + signed_in_resource.save! redirect_headers = build_redirect_headers(token.token, token.client, diff --git a/test/controllers/devise_token_auth/confirmations_controller_test.rb b/test/controllers/devise_token_auth/confirmations_controller_test.rb index 29ef2b8aa..7da4341e5 100644 --- a/test/controllers/devise_token_auth/confirmations_controller_test.rb +++ b/test/controllers/devise_token_auth/confirmations_controller_test.rb @@ -53,6 +53,10 @@ def token_and_client_config_from(body) assert @resource.confirmed? end + test 'should save the authentication token' do + assert @resource.reload.tokens.present? + end + test 'should redirect to success url' do assert_redirected_to(/^#{@redirect_url}/) end