OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#43653] reapply result check, but with correct message
Eric Schubert66bae17235f4
diff --git a/app/services/oauth_clients/connection_manager.rb b/app/services/oauth_clients/connection_manager.rbindex bbac9482539..aa0422df0d1 100644--- a/app/services/oauth_clients/connection_manager.rb+++ b/app/services/oauth_clients/connection_manager.rb@@ -132,7 +132,16 @@ module OAuthClientsservice_result = refresh_token # `refresh_token` already has exception handlingreturn :connected if service_result.success?- :failed_authorization+ if service_result.result == 'invalid_request'+ # This can happen if the Authorization Server invalidated all tokens.+ # Then the user would ideally be asked to reauthorize.+ :failed_authorization+ else+ # It could also be that some other error happened, i.e. firewall badly configured.+ # Then the user needs to know that something is technically off. The user could try+ # to reload the page or contact an admin.+ :error+ endrescue StandardError:errorenddiff --git a/spec/services/oauth_clients/connection_manager_spec.rb b/spec/services/oauth_clients/connection_manager_spec.rbindex 6ae30c63c5e..194536ae4a6 100644--- a/spec/services/oauth_clients/connection_manager_spec.rb+++ b/spec/services/oauth_clients/connection_manager_spec.rb@@ -427,7 +427,7 @@ describe ::OAuthClients::ConnectionManager, type: :model doendcontext 'with invalid refresh token' do- let(:refresh_service_result) { ServiceResult.failure(result: 'invalid_grant') }+ let(:refresh_service_result) { ServiceResult.failure(result: 'invalid_request') }it 'refreshes the access token and returns :failed_authorization' doexpect(subject).to eq :failed_authorization