From 86ed0acd04bcc9dd4f802c1275c94a39a2b74675 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Fri, 8 Dec 2023 11:01:22 +0300 Subject: [PATCH] Client:PortalSettings:OAuth2: fix copy client id and client secret --- packages/client/public/locales/en/OAuth.json | 2 ++ .../ClientForm/components/ClientBlock.tsx | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/packages/client/public/locales/en/OAuth.json b/packages/client/public/locales/en/OAuth.json index 28b381d93a..730eb08bdf 100644 --- a/packages/client/public/locales/en/OAuth.json +++ b/packages/client/public/locales/en/OAuth.json @@ -13,6 +13,7 @@ "AuthorizeLink": "Authorize link", "AuthenticationMethod": "Authentication method", "Client": "Client", + "ClientCopy": "Client id successfully copied to clipboard", "Creator": "Creator", "ClientHelpButton": "Credentials for using OAth 2.0 as your Authentication type.
Note: Any enterprise admin who knows the app's client ID will be able to retrieve information about the app including app name, authentication type, app scopes and redirect URI.", "CodeVerifier": "Code verifier", @@ -46,6 +47,7 @@ "RevokeConsentLogin": "If you want to renew an automatic login into {{name}} using ONLYOFFICE DocSpace, you will be asked to grant access to your DocSpace account data.", "RevokeConsentLoginGroup": "If you want to renew an automatic login using ONLYOFFICE DocSpace, you will be asked to grant access to your DocSpace account data.", "Secret": "Secret", + "SecretCopy": "Client secret successfully copied to clipboard", "SelectNewImage": "Select new image", "Scopes": "Scopes", "ScopesHeader": "Access scopes", diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ClientBlock.tsx b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ClientBlock.tsx index e2a0eb0210..967971c0bf 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ClientBlock.tsx +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ClientBlock.tsx @@ -1,5 +1,9 @@ import React from "react"; import { Trans } from "react-i18next"; +import copy from "copy-to-clipboard"; + +//@ts-ignore +import toastr from "@docspace/components/toast/toastr"; import { StyledBlock, StyledInputBlock } from "../ClientForm.styled"; @@ -32,6 +36,16 @@ const ClientBlock = ({ const onChange = (e: React.ChangeEvent) => {}; + const onCopyClick = (name: string) => { + if (name === "id") { + copy(value[name]); + toastr.success(t("ClientCopy")); + } else { + copy(value[name]); + toastr.success(t("SecretCopy")); + } + }; + const helpButtonText = ; return ( @@ -46,6 +60,7 @@ const ClientBlock = ({ error={""} onChange={onChange} withCopy + onCopyClick={() => onCopyClick("id")} /> onCopyClick("secret")} />