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

fix[Op#50737]: Fix clipboard copy by setting HTML value on clientID input

Kabiru Mwenjafc88cdeeda3c
diff --git a/frontend/src/stimulus/controllers/dynamic/storages/oauth-client-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/storages/oauth-client-form.controller.ts
index e1e82369c31..74953341175 100644
--- a/frontend/src/stimulus/controllers/dynamic/storages/oauth-client-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/storages/oauth-client-form.controller.ts
@@ -47,17 +47,13 @@ export default class OAuthClientFormController extends Controller {
declare readonly hasSubmitButtonTarget:boolean;
declare readonly clientIdTarget:HTMLInputElement;
declare readonly clientSecretTarget:HTMLInputElement;
- declare readonly redirectUriTarget:HTMLInputElement;
+ declare readonly redirectUriTargets:HTMLInputElement[];
declare readonly submitButtonTarget:HTMLInputElement;
declare readonly clientIdMissingValue:string;
connect():void {
- this.clientIdTarget.addEventListener('input', () => {
- this.redirectUriTarget.value = this.redirectUri();
- });
-
- this.redirectUriTarget.value = this.redirectUri();
+ this.setRedirectUriValue();
this.toggleSubmitButtonDisabled();
}
@@ -75,6 +71,14 @@ export default class OAuthClientFormController extends Controller {
}
}
+ public setRedirectUriValue():void {
+ const newValue = this.redirectUri();
+ this.redirectUriTargets.forEach((target) => {
+ target.value = newValue;
+ target.setAttribute('value', newValue);
+ });
+ }
+
private redirectUri():string {
if (this.clientIdTarget.value === '') {
return this.clientIdMissingValue;
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 1c3897c11b4..d929d467b1f 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
@@ -27,7 +27,8 @@
client_id_input_options: {
data: {
'storages--oauth-client-form-target': 'clientId',
- action: 'input->storages--oauth-client-form#toggleSubmitButtonDisabled'
+ action: 'input->storages--oauth-client-form#toggleSubmitButtonDisabled '\
+ 'input->storages--oauth-client-form#setRedirectUriValue'
}
},
client_secret_input_options: {
diff --git a/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client.html.erb b/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client.html.erb
index 5ab62161277..f007793e962 100644
--- a/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/one_drive/_oauth_client.html.erb
@@ -39,7 +39,8 @@ See COPYRIGHT and LICENSE files for more details.
size: 40,
container_class: '-wide',
data: {
- 'storages--oauth-client-form-target': "clientId"
+ 'storages--oauth-client-form-target': "clientId",
+ action: 'input->storages--oauth-client-form#setRedirectUriValue'
} %>
<span class="form--field-instructions">
<%= t("storages.instructions.#{@storage.short_provider_type}.oauth_client_id") %>