Skip to content

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

Fixed storage oauth credential replace to show plaintext secret

Andreas Pfohl68c45aee8b77
diff --git a/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.html.erb b/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.html.erb
index 6cf35ab5e47..0358cbe2df6 100644
--- a/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.html.erb
+++ b/modules/storages/app/components/storages/admin/oauth_application_info_copy_component.html.erb
@@ -24,7 +24,7 @@
OpenProject::Common::ClipboardCopyComponent.new(
name: :openproject_oauth_application_secret,
visually_hide_label: false,
- value_to_copy: oauth_application.secret,
+ value_to_copy: oauth_application.plaintext_secret,
label: I18n.t('storages.label_openproject_oauth_application_secret'),
required: true
)
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index 68035f8403a..43bf83fa2cf 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -91,6 +91,12 @@ RSpec.describe 'Admin storages',
describe 'New file storage', with_flag: { storage_primer_design: true } do
context 'with Nextcloud Storage' do
+ let(:secret) { 'awesome_secret' }
+
+ before do
+ allow(Doorkeeper::OAuth::Helpers::UniqueToken).to receive(:generate).and_return(secret)
+ end
+
it 'renders a Nextcloud specific multi-step form', :webmock do
visit admin_settings_storages_path
@@ -153,7 +159,7 @@ RSpec.describe 'Admin storages',
expect(page).to have_css('#openproject_oauth_application_uid',
value: storage.reload.oauth_application.uid)
expect(page).to have_css('#openproject_oauth_application_secret',
- value: storage.reload.oauth_application.secret)
+ value: secret)
click_link 'Done, continue'
end
@@ -304,8 +310,10 @@ RSpec.describe 'Admin storages',
let(:storage) { create(:nextcloud_storage, :as_automatically_managed) }
let(:oauth_application) { create(:oauth_application, integration: storage) }
let(:oauth_client) { create(:oauth_client, integration: storage) }
+ let(:secret) { 'awesome_secret' }
before do
+ allow(Doorkeeper::OAuth::Helpers::UniqueToken).to receive(:generate).and_return(secret)
oauth_application
oauth_client
end
@@ -385,7 +393,7 @@ RSpec.describe 'Admin storages',
expect(page).to have_css('#openproject_oauth_application_uid',
value: storage.reload.oauth_application.uid)
expect(page).to have_css('#openproject_oauth_application_secret',
- value: storage.reload.oauth_application.secret)
+ value: secret)
click_link 'Done, continue'
end