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

[#51270] Update OneDrive/SharePoint oauth client form design labels (#14303)

Kabiru Mwenjaa423df928082
diff --git a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb
index 602b9d0b42a..a828a4c4c1c 100644
--- a/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/oauth_client_form_component.html.erb
@@ -43,7 +43,7 @@
if storage.provider_type_one_drive?
oauth_client_row.with_row(mb: 3) do
- render(Primer::OpenProject::InputGroup.new(input_width: :large)) do |input_group|
+ concat(render(Primer::OpenProject::InputGroup.new(input_width: :large)) do |input_group|
input_group.with_text_input(name: :oauth_client_redirect_uri,
label: I18n.t('storages.label_redirect_uri'),
visually_hide_label: false,
@@ -60,7 +60,14 @@
data: {
'storages--oauth-client-form-target': 'redirectUri'
})
- end
+ end)
+
+ # NOTE: Hardcoded `FormControl-caption` class is used to align the text with the input field.
+ # This is a workaround until Primer::OpenProject::InputGroup supports a caption.
+ # See https://community.openproject.org/wp/51376
+ concat(render(Primer::Beta::Text.new(classes: 'FormControl-caption')) do
+ I18n.t('storages.instructions.one_drive.oauth_client_redirect_uri')
+ end)
end
end
diff --git a/modules/storages/app/forms/storages/admin/oauth_client_form.rb b/modules/storages/app/forms/storages/admin/oauth_client_form.rb
index dadfcedf21f..52aa69c0dd8 100644
--- a/modules/storages/app/forms/storages/admin/oauth_client_form.rb
+++ b/modules/storages/app/forms/storages/admin/oauth_client_form.rb
@@ -57,19 +57,23 @@ module Storages::Admin
label: label_client_secret,
required: true,
input_width: :large
- }
+ }.merge(provider_default_client_secret_input_options)
end
- def label_client_id
- [label_provider_name, I18n.t('storages.label_oauth_client_id')].join(' ')
+ def provider_default_client_secret_input_options
+ {}.tap do |options_h|
+ if @storage.provider_type_one_drive?
+ options_h[:caption] = I18n.t('storages.instructions.one_drive.oauth_client_secret')
+ end
+ end
end
- def label_client_secret
- [label_provider_name, I18n.t('storages.label_oauth_client_secret')].join(' ')
+ def label_client_id
+ I18n.t("storages.provider_types.#{@storage.short_provider_type}.label_oauth_client_id")
end
- def label_provider_name
- I18n.t("storages.provider_types.#{@storage.short_provider_type}.name")
+ def label_client_secret
+ I18n.t("storages.provider_types.#{@storage.short_provider_type}.label_oauth_client_secret")
end
end
end
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index 9a6e9cb790f..77595b6ba5b 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -149,8 +149,9 @@ en:
oauth_client_id: >
Copy the client id from the Azure portal. This is needed to generate the redirect URI.
oauth_client_secret: >
- Copy the client secret from the Azure portal. For a newly created application the secret first needs to be
- created manually. For authorization of web applications a secret is mandatory.
+ The client secret has been automatically copied from an already fully connected file storage with the same Application (client) ID.
+ oauth_client_redirect_uri: >
+ Please copy this value to a new Web redirect URI under Redirect URIs.
missing_client_id_for_redirect_uri: "Please fill the OAuth values to generate a URI"
tenant_id: "Please copy the tenant from your Azure application."
tenant_id_placeholder: "Name or UUID"
@@ -240,9 +241,13 @@ en:
nextcloud:
name: "Nextcloud"
name_placeholder: "e.g. Nextcloud"
+ label_oauth_client_id: "Nextcloud OAuth Client ID"
+ label_oauth_client_secret: "Nextcloud OAuth Client Secret"
one_drive:
name: "OneDrive/SharePoint"
name_placeholder: "e.g. OneDrive"
+ label_oauth_client_id: "Azure OAuth Application (client) ID"
+ label_oauth_client_secret: "Azure OAuth Client Secret Value"
confirm_replace_oauth_application: "Are you sure? All users will have to authorize again against OpenProject."
confirm_replace_oauth_client: "Are you sure? All users will have to authorize again against the storage."
oauth_client_details_missing: "To complete the setup, please add OAuth client credentials from your storage."