Client:PortalSettings:OAuth2: enable allowed origins for edit, fix error translation
This commit is contained in:
parent
86ed0acd04
commit
80ebe7c16a
@ -20,7 +20,7 @@
|
||||
"EditApp": "Edit application",
|
||||
"EnterDescription": "Enter description",
|
||||
"ErrorName": "Minimal name length:",
|
||||
"ErrorWrongURL": "Wrong URL",
|
||||
"ErrorWrongURL": "URL not valid, example",
|
||||
"EnterURL": "Enter URL",
|
||||
"IconDescription": "JPG, PNG or SVG, 32x32",
|
||||
"ID": "ID",
|
||||
|
@ -153,7 +153,7 @@ const BasicBlock = ({
|
||||
name={"website_url"}
|
||||
placeholder={t("EnterURL")}
|
||||
value={websiteUrlValue}
|
||||
error={`${t("ErrorWrongURL")}`}
|
||||
error={`${t("ErrorWrongURL")}: ${window.location.origin}`}
|
||||
onChange={onChange}
|
||||
disabled={isEdit}
|
||||
isRequired
|
||||
|
@ -74,7 +74,7 @@ const MultiInputGroup = ({
|
||||
value={value}
|
||||
placeholder={placeholder}
|
||||
onChange={onChange}
|
||||
error={t("ErrorWrongURL")}
|
||||
error={`${t("ErrorWrongURL")}: ${window.location.origin}`}
|
||||
isRequired
|
||||
isError={isError}
|
||||
>
|
||||
|
@ -46,7 +46,6 @@ const OAuthBlock = ({
|
||||
onAdd={changeValue}
|
||||
currentValue={allowedOriginsValue}
|
||||
helpButtonText={t("AllowedOriginsHelpButton")}
|
||||
isDisabled={isEdit}
|
||||
/>
|
||||
</StyledInputBlock>
|
||||
</StyledBlock>
|
||||
|
@ -43,7 +43,7 @@ const SupportBlock = ({
|
||||
name={"policy_url"}
|
||||
placeholder={t("EnterURL")}
|
||||
value={policyUrlValue}
|
||||
error={t("ErrorWrongURL")}
|
||||
error={`${t("ErrorWrongURL")}: ${window.location.origin}`}
|
||||
onChange={onChange}
|
||||
helpButtonText={t("PrivacyPolicyURLHelpButton")}
|
||||
disabled={isEdit}
|
||||
@ -56,7 +56,7 @@ const SupportBlock = ({
|
||||
name={"terms_url"}
|
||||
placeholder={t("EnterURL")}
|
||||
value={termsUrlValue}
|
||||
error={t("ErrorWrongURL")}
|
||||
error={`${t("ErrorWrongURL")}: ${window.location.origin}`}
|
||||
onChange={onChange}
|
||||
helpButtonText={t("TermsOfServiceURLHelpButton")}
|
||||
disabled={isEdit}
|
||||
|
@ -156,10 +156,16 @@ const ClientForm = ({
|
||||
website_url: fetchedClient?.websiteUrl || client?.websiteUrl || "",
|
||||
description: fetchedClient?.description || client?.description || "",
|
||||
|
||||
redirect_uris:
|
||||
fetchedClient?.redirectUris || client?.redirectUris || [],
|
||||
allowed_origins:
|
||||
fetchedClient?.allowedOrigins || client?.allowedOrigins || [],
|
||||
redirect_uris: fetchedClient?.redirectUris
|
||||
? [...fetchedClient?.redirectUris]
|
||||
: client?.redirectUris
|
||||
? [...client?.redirectUris]
|
||||
: [],
|
||||
allowed_origins: fetchedClient?.allowedOrigins
|
||||
? [...fetchedClient.allowedOrigins]
|
||||
: client?.allowedOrigins
|
||||
? [...client.allowedOrigins]
|
||||
: [],
|
||||
logout_redirect_uri:
|
||||
fetchedClient?.logoutRedirectUri || client?.logoutRedirectUri || "",
|
||||
|
||||
@ -173,7 +179,11 @@ const ClientForm = ({
|
||||
client?.authenticationMethods.includes(AuthenticationMethod.none) ||
|
||||
false,
|
||||
|
||||
scopes: fetchedClient?.scopes || client?.scopes || [],
|
||||
scopes: fetchedClient?.scopes
|
||||
? [...fetchedClient.scopes]
|
||||
: client?.scopes
|
||||
? [...client.scopes]
|
||||
: [],
|
||||
});
|
||||
|
||||
setClientId(fetchedClient?.clientId || client?.clientId || "");
|
||||
@ -257,13 +267,21 @@ const ClientForm = ({
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
isValid,
|
||||
form?.allowed_origins?.length,
|
||||
initialClient?.allowedOrigins?.length
|
||||
);
|
||||
|
||||
return (
|
||||
isValid &&
|
||||
form.name &&
|
||||
form.logo &&
|
||||
form.allowed_origins.length > 0 &&
|
||||
(form.name !== initialClient.name ||
|
||||
form.logo !== initialClient.logo ||
|
||||
form.description !== initialClient.description ||
|
||||
form.allowed_origins.length !== initialClient.allowedOrigins.length ||
|
||||
form.allow_pkce !==
|
||||
initialClient.authenticationMethods.includes(
|
||||
AuthenticationMethod.none
|
||||
|
Loading…
Reference in New Issue
Block a user