diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6cafae2c..396f490f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,8 @@
- Refactorization of CustomDataContainer to prevent passing invalid format of `uri` prop. Added documentation. (INDIGO Sprint 221209, [!11](https://github.com/TeskaLabs/seacat-admin-webui/pull/11))
+- Add new input `cookie_domain` to Clients. Fix min-max height styles for CustomComponent (INDIGO Sprint 230120, [!15](https://github.com/TeskaLabs/seacat-admin-webui/pull/15))
+
## v22.48
### Compatibility
diff --git a/public/locales/cs/translation.json b/public/locales/cs/translation.json
index 561a660f..cd32888f 100644
--- a/public/locales/cs/translation.json
+++ b/public/locales/cs/translation.json
@@ -103,6 +103,7 @@
"Grant types": "Typy grantů",
"Application type": "Typ aplikace",
"Token endpoint authentication method": "Způsob autentikace pro získání tokenu",
+ "Cookie domain": "Cookie doména",
"Redirect URIs": "URIs k přesměrování",
"Create client": "Vytvořit klienta",
"Unknown item": "Neznámá položka"
@@ -127,18 +128,23 @@
"Response types": "Typy odpovědí",
"Grant types": "Typy grantů",
"Token endpoint auth. method": "Způsob autentikace pro získání tokenu",
+ "Cookie domain": "Cookie doména",
"Redirect URIs": "URIs k přesměrování",
"Redirect URI must be in absolute format without a fragment component.": "URI k přesměrování musí být v absolutním formátu a bez fragment komponenty.",
- "Remove client": "Odstranit klienta"
+ "Remove client": "Odstranit klienta",
+ "Save changes": "Uložit změny",
+ "No changes were made": "Nebyly provedeny žádné změny"
},
"ClientFormField": {
"Add new input": "Přidat pole",
"Remove input": "Odstranit pole",
"Invalid format, input should have minimum of 8 characters": "Nesprávný formát, pole musí mít minimálně 8 znaků",
+ "Invalid format for cookie_domain": "Nesprávný formát pro cookie_domain",
"URI can't be empty": "URI nemůže být prázdný",
"URI have to start with https": "URI musí začínat https",
"URL hash have to be empty": "URL hash musí být prázdný",
- "Choose an option": "Zvolte možnost"
+ "Choose an option": "Zvolte možnost",
+ "Required field": "Povinný údaj"
},
"CredentialsCreateContainer": {
"Create new credentials": "Vytvořit nové údaje",
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index 79059b5c..7921e58d 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -103,6 +103,7 @@
"Grant types": "Grant types",
"Application type": "Application type",
"Token endpoint authentication method": "Token endpoint authentication method",
+ "Cookie domain": "Cookie domain",
"Redirect URIs": "Redirect URIs",
"Create client": "Create client",
"Unknown item": "Unknown item"
@@ -127,18 +128,23 @@
"Response types": "Response types",
"Grant types": "Grant types",
"Token endpoint auth. method": "Token endpoint auth. method",
+ "Cookie domain": "Cookie domain",
"Redirect URIs": "Redirect URIs",
"Redirect URI must be in absolute format without a fragment component.": "Redirect URI must be in absolute format without a fragment component.",
- "Remove client": "Remove client"
+ "Remove client": "Remove client",
+ "Save changes": "Save changes",
+ "No changes were made": "No changes were made"
},
"ClientFormField": {
"Add new input": "Add new input",
"Remove input": "Remove input",
"Invalid format, input should have minimum of 8 characters": "Invalid format, input should have minimum of 8 characters",
+ "Invalid format for cookie_domain": "Invalid format for cookie_domain",
"URI can't be empty": "URI can't be empty",
"URI have to start with https": "URI have to start with https",
"URL hash have to be empty": "URL hash have to be empty",
- "Choose an option": "Choose an option"
+ "Choose an option": "Choose an option",
+ "Required field": "Required field"
},
"CredentialsCreateContainer": {
"Create new credentials": "Create new credentials",
diff --git a/src/modules/auth/clients/ClientCreateContainer.js b/src/modules/auth/clients/ClientCreateContainer.js
index ae026a32..89a67697 100644
--- a/src/modules/auth/clients/ClientCreateContainer.js
+++ b/src/modules/auth/clients/ClientCreateContainer.js
@@ -112,6 +112,14 @@ const ClientCreateContainer = (props) => {
delete body.preferred_client_id;
}
+ if (body.client_uri == "") {
+ delete body.client_uri;
+ }
+
+ if (body.cookie_domain == "") {
+ delete body.cookie_domain;
+ }
+
try {
let response = await SeaCatAuthAPI.post(`/client`, body);
if (response.statusText != 'OK') {
@@ -187,9 +195,10 @@ const ClientCreateContainer = (props) => {
{metaData["properties"] && Object.entries(metaData["properties"]).map(([key, value]) => {
switch(key) {
- case 'redirect_uris': return()
- case 'client_name': return()
+ case 'redirect_uris': return()
+ case 'client_name': return()
case 'client_uri': return()
+ case 'cookie_domain': return()
case 'preferred_client_id': return()
case 'response_types': return(selectedTemplate === "Custom" && )
case 'grant_types': return(selectedTemplate === "Custom" && )
diff --git a/src/modules/auth/clients/ClientDetailContainer.js b/src/modules/auth/clients/ClientDetailContainer.js
index d5d70031..e31fe1c5 100644
--- a/src/modules/auth/clients/ClientDetailContainer.js
+++ b/src/modules/auth/clients/ClientDetailContainer.js
@@ -27,7 +27,7 @@ const ClientDetailContainer = (props) => {
const advmode = useSelector(state => state.advmode.enabled);
- const { handleSubmit, formState: { errors }, control, setValue, reset, register } = useForm({
+ const { handleSubmit, formState: { errors, isSubmitting, isDirty }, control, setValue, reset, register } = useForm({
defaultValues: {
redirect_uris: [{ text: ""}],
}
@@ -100,7 +100,9 @@ const ClientDetailContainer = (props) => {
await Promise.all(Object.values(values[key]).map((item, index) => {
uri.push(item.text)
}))
- } else {
+ } else if (key == "client_name") {
+ body[key] = values[key];
+ } else if (key == "cookie_domain") {
body[key] = values[key];
}
}))
@@ -111,10 +113,7 @@ const ClientDetailContainer = (props) => {
}
try {
- let response = await SeaCatAuthAPI.put(`/client/${client_id}`, {
- redirect_uris: body?.redirect_uris,
- client_name: body?.client_name
- });
+ let response = await SeaCatAuthAPI.put(`/client/${client_id}`, body);
if (response.statusText != 'OK') {
throw new Error("Unable to change client details");
}
@@ -123,7 +122,6 @@ const ClientDetailContainer = (props) => {
setDisabled(false);
getClientDetail();
props.app.addAlert("success", t("ClientDetailContainer|Client updated successfully"));
-
} catch (e) {
setDisabled(false);
setEditMode(true);
@@ -169,38 +167,27 @@ const ClientDetailContainer = (props) => {
- {client?.client_name ?
-
- {t("ClientDetailContainer|Client name")}
- {editMode ?
-
-
-
-
+
+ {t("ClientDetailContainer|Client name")}
+ {editMode ?
+
+
+
:
- {client?.client_name}
- }
-
- :
- editMode &&
-
- {t("ClientDetailContainer|Client name")}
-
-
- }
+ {client?.client_name ? client.client_name : "N/A"}
+ }
+
- {t("ClientDetailContainer|Client ID")}
+ {t("ClientDetailContainer|Client ID")}
{client?.client_id}
- {client?.client_uri &&
-
- {t("ClientDetailContainer|Client URI")}
- {client?.client_uri}
-
- }
+
+ {t("ClientDetailContainer|Client URI")}
+ {client?.client_uri ? client.client_uri : "N/A"}
+
{client?.client_secret &&
- {t("ClientDetailContainer|Client secret")}
+ {t("ClientDetailContainer|Client secret")}
{client?.client_secret}
}
- {t("Created at")}
+ {t("Created at")}
- {t("Modified at")}
+ {t("Modified at")}
@@ -249,6 +236,16 @@ const ClientDetailContainer = (props) => {
{t("ClientDetailContainer|Token endpoint auth. method")}
{client?.token_endpoint_auth_method}
+
+ {t("ClientDetailContainer|Cookie domain")}
+ {editMode ?
+
+
+
+ :
+ {client?.cookie_domain ? client.cookie_domain : "N/A"}
+ }
+
{t("ClientDetailContainer|Redirect URIs")}
@@ -269,10 +266,24 @@ const ClientDetailContainer = (props) => {
{editMode ?
<>
-
-
+
+
>
- :
+ :
<>
(/^[-_a-zA-Z0-9]{8,64}$|^$/).test(value) || t("ClientFormField|Invalid format, input should have minimum of 8 characters"),
}
}
+ :
+ (name === "cookie_domain") && {
+ validate: {
+ validation: value => (/^[a-z0-9\.-]{1,61}\.[a-z]{2,}$|^$/).test(value) || t("ClientFormField|Invalid format for cookie_domain"),
+ }
+ }
);
+
+ const isInvalid = (name) => {
+ if (((name === "preferred_client_id") || (name === "cookie_domain")) && (errors[name] != undefined)) {
+ return true;
+ }
+ return false;
+ }
return (
- {labelName && }
+ {labelName && }
- {errors?.preferred_client_id && {errors.preferred_client_id.message}}
+ {name === "preferred_client_id" && (errors.preferred_client_id != undefined && {errors.preferred_client_id?.message})}
+ {name === "cookie_domain" && (errors?.cookie_domain && {errors.cookie_domain?.message})}
)
}
@@ -69,7 +83,7 @@ export function URiInput ({ name, control, errors, append, remove, fields, label
return (
{(labelName && name) &&
- }
+ }
{fields && fields.map((item, idx) => {
return (
diff --git a/src/modules/auth/clients/clients.scss b/src/modules/auth/clients/clients.scss
index 1e844631..dbcd0a78 100644
--- a/src/modules/auth/clients/clients.scss
+++ b/src/modules/auth/clients/clients.scss
@@ -47,7 +47,7 @@ $svg-arrow: var(--svg-arrow);
.form-group {
margin-bottom: 0;
}
- .client-name {
+ .client-edit {
height: 40px;
}
.redirect_uris {
diff --git a/src/modules/auth/components/CustomDataContainer.js b/src/modules/auth/components/CustomDataContainer.js
index 53ae4a39..f752c932 100644
--- a/src/modules/auth/components/CustomDataContainer.js
+++ b/src/modules/auth/components/CustomDataContainer.js
@@ -97,7 +97,7 @@ export function CustomDataContainer({app, resources, customData, setCustomData,
-