Client:PortalSettings:OAuth2: fix copy client id and client secret

This commit is contained in:
Timofey Boyko 2023-12-08 11:01:22 +03:00
parent 20c3d69d42
commit 86ed0acd04
2 changed files with 18 additions and 0 deletions

View File

@ -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.<br/> <strong>Note</strong>: 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",

View File

@ -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<HTMLInputElement>) => {};
const onCopyClick = (name: string) => {
if (name === "id") {
copy(value[name]);
toastr.success(t("ClientCopy"));
} else {
copy(value[name]);
toastr.success(t("SecretCopy"));
}
};
const helpButtonText = <Trans t={t} i18nKey="ClientHelpButton" ns="OAuth" />;
return (
@ -46,6 +60,7 @@ const ClientBlock = ({
error={""}
onChange={onChange}
withCopy
onCopyClick={() => onCopyClick("id")}
/>
<InputGroup
label={t("Secret")}
@ -58,6 +73,7 @@ const ClientBlock = ({
isPassword
buttonLabel={t("Reset")}
onButtonClick={onResetClick}
onCopyClick={() => onCopyClick("secret")}
/>
</StyledInputBlock>
</StyledBlock>