From cf695626a6e3a34fd1a9476e45d2d606edf16168 Mon Sep 17 00:00:00 2001 From: ikhomyn <89014675+ikhomyn@users.noreply.github.com> Date: Sun, 6 Mar 2022 16:26:52 +0100 Subject: [PATCH] fixed msg error when clientScope created with whitespace (#1997) (#2162) --- src/client-scopes/details/ScopeForm.tsx | 6 +++++- src/client-scopes/form/ClientScopeForm.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client-scopes/details/ScopeForm.tsx b/src/client-scopes/details/ScopeForm.tsx index deb3538af6..19a4a91fa7 100644 --- a/src/client-scopes/details/ScopeForm.tsx +++ b/src/client-scopes/details/ScopeForm.tsx @@ -78,7 +78,11 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => { helperTextInvalid={t("common:required")} > + !!value.trim() || t("common:required").toString(), + })} type="text" id="kc-name" name="name" diff --git a/src/client-scopes/form/ClientScopeForm.tsx b/src/client-scopes/form/ClientScopeForm.tsx index 8862a48860..e006105d14 100644 --- a/src/client-scopes/form/ClientScopeForm.tsx +++ b/src/client-scopes/form/ClientScopeForm.tsx @@ -106,7 +106,7 @@ export default function ClientScopeForm() { const save = async (clientScopes: ClientScopeDefaultOptionalType) => { try { - clientScopes.name = clientScopes.name?.trim(); + clientScopes.name = clientScopes.name?.trim().replace(/ /g, "_"); clientScopes = convertFormValuesToObject( clientScopes ) as ClientScopeDefaultOptionalType;