From 20073c7158d1cc368ef8cc6db5095007dcecbc88 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Tue, 5 Dec 2023 17:00:46 +0300 Subject: [PATCH] Client:PortalSettings:OAuth2: fix translation --- packages/client/public/locales/en/OAuth.json | 9 +++-- .../ClientForm/ClientForm.styled.ts | 8 +++++ .../ClientForm/components/BasicBlock.tsx | 36 ++++++++++++++----- .../ClientForm/components/ScopesBlock.tsx | 10 +++--- .../ClientForm/components/SelectGroup.tsx | 2 +- packages/common/utils/oauth/index.ts | 4 +-- packages/common/utils/oauth/interfaces.ts | 4 +-- 7 files changed, 51 insertions(+), 22 deletions(-) diff --git a/packages/client/public/locales/en/OAuth.json b/packages/client/public/locales/en/OAuth.json index 86df2099b8..28b381d93a 100644 --- a/packages/client/public/locales/en/OAuth.json +++ b/packages/client/public/locales/en/OAuth.json @@ -4,11 +4,14 @@ "AppIcon": "App icon", "AllowedOrigins": "Allowed origins", "AllowedOriginsHelpButton": "URLs added here are used to improve the OAuth redirect security.", + "AllowPKCE": "Allow public client (PKCE)", + "AllowPKCEHelpButton": "PKCE is not a form of client authentication, and PKCE is not a replacement for a client secret or another client authentication type. PKCE is recommended even if a client is using a client secret or another form of client authentication like private_key_jwt.
Note: Since PKCE is not a replacement for client authentication, it does not allow treating a public client as confidential one.", "AppName": "App name", "Apps": "Applications", "AuthButton": "Auth button", "AuthorizedApps": "Authorized apps", "AuthorizeLink": "Authorize link", + "AuthenticationMethod": "Authentication method", "Client": "Client", "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.", @@ -24,7 +27,7 @@ "NewApp": "New application", "NoAuthorizedApps": "No authorized apps", "NoOAuthAppHeader": "No OAuth applications", - "OAuth": "OAuth", + "OAuth": "OAuth 2.0", "OAuthAppDescription": "OAuth applications are used to access the ONLYOFFICE DocSpace API for authorization and further actions such as accessing files, etc.", "OAuthHeaderBlock": "OAuth urls", "ProfileDescription": "Here you can check the apps info to which you have granted the auth access, and revoke consent if needed.", @@ -33,7 +36,7 @@ "PrivacyPolicyURLHelpButton": "Provide a URL link to your Privacy Policy that must comply with applicable laws and regulations and that make clear how you collect, use, share, retain and otherwise process personal information.", "Read": "Read", "RedirectsURLS": "Redirects URLS", - "RedirectsURLSHelpButton": "Redirect uris help button", + "RedirectsURLSHelpButton": "After a user successfully authorizes an application, the authorization server will redirect the user back to the application with sensitive information.", "RegisterNewApp": "Register a new application", "Reset": "Reset", "Revoke": "Revoke", @@ -51,7 +54,7 @@ "SupportAndLegalInfo": "Support & Legal info", "TermsOfService": "Terms of Service", "TermsOfServiceURL": "Terms of Service URL", - "TermsOfServiceURLHelpButton": "Terms of service help", + "TermsOfServiceURLHelpButton": "Terms and conditions that users must comply with when using this application.", "WebsiteUrl": "Website URL", "Write": "Write" } diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts index 7a4a5172b5..3127a43d67 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts @@ -77,6 +77,14 @@ const StyledInputGroup = styled.div` cursor: pointer; } + .pkce { + margin-top: 4px; + + display: flex; + align-items: center; + gap: 0px; + } + .select { display: flex; flex-direction: row; diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/BasicBlock.tsx b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/BasicBlock.tsx index 42108a3ffb..83ba74c124 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/BasicBlock.tsx +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/BasicBlock.tsx @@ -1,7 +1,8 @@ import React from "react"; +import { Trans } from "react-i18next"; -import ComboBox from "@docspace/components/combobox"; -import { AuthenticationMethod } from "@docspace/common/utils/oauth/enums"; +//@ts-ignore +import HelpButton from "@docspace/components/help-button"; import { StyledBlock, StyledInputBlock } from "../ClientForm.styled"; @@ -9,6 +10,7 @@ import BlockHeader from "./BlockHeader"; import InputGroup from "./InputGroup"; import TextAreaGroup from "./TextAreaGroup"; import SelectGroup from "./SelectGroup"; + import Checkbox from "@docspace/components/checkbox"; interface BasicBlockProps { @@ -125,6 +127,10 @@ const BasicBlock = ({ } }; + const pkceHelpButtonText = ( + + ); + return ( @@ -164,13 +170,25 @@ const BasicBlock = ({ value={descriptionValue} onChange={onChange} /> - { - changeValue("allow_pkce", !allowPkce); - }} - /> + {}} + > +
+ { + changeValue("allow_pkce", !allowPkce); + }} + /> + +
+
); diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ScopesBlock.tsx b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ScopesBlock.tsx index 30276cc2ea..9d764ba78a 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ScopesBlock.tsx +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/ScopesBlock.tsx @@ -151,9 +151,9 @@ const ScopesBlock = ({ fontWeight={600} lineHeight={"16px"} > - {scope.write.name} + {scope.write?.name} {" "} - — {t(`Common:${scope.write.tKey}`)} + — {t(`Common:${scope.write?.tKey}`)} @@ -171,15 +171,15 @@ const ScopesBlock = ({ /> - {scope.read?.name && ( + {scope.write?.name && ( onAddCheckedScope( key as ScopeGroup, ScopeType.write, - scope.write.name + scope.write?.name ) } /> diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/SelectGroup.tsx b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/SelectGroup.tsx index 03eb8b6a6c..b9b90ce9c7 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/SelectGroup.tsx +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/components/SelectGroup.tsx @@ -56,7 +56,7 @@ const SelectGroup = ({ color={""} textAlign={""} > - {label} + {label} *
diff --git a/packages/common/utils/oauth/index.ts b/packages/common/utils/oauth/index.ts index 741b388fe6..4ee0b39330 100644 --- a/packages/common/utils/oauth/index.ts +++ b/packages/common/utils/oauth/index.ts @@ -134,8 +134,8 @@ export const filterScopeByGroup = ( filteredScopes[scope.group] = { isChecked, checkedType: isChecked ? scope.type : undefined, - read: undefined, - write, + read: write, + write: undefined, }; return; diff --git a/packages/common/utils/oauth/interfaces.ts b/packages/common/utils/oauth/interfaces.ts index fc97b331d9..644659be60 100644 --- a/packages/common/utils/oauth/interfaces.ts +++ b/packages/common/utils/oauth/interfaces.ts @@ -11,8 +11,8 @@ export interface IFilteredScopes { [key: string]: { isChecked: boolean; checkedType?: ScopeType; - read?: IScope; - write: IScope; + read: IScope; + write?: IScope; }; }