Trim names of client, realm role, user and group before saving (#1639)
This commit is contained in:
parent
e53c7744a1
commit
7cef4ae2d4
5 changed files with 12 additions and 1 deletions
|
@ -274,6 +274,9 @@ export default function ClientDetails() {
|
|||
webOrigins,
|
||||
attributes,
|
||||
};
|
||||
|
||||
newClient.clientId = newClient.clientId?.trim();
|
||||
|
||||
await adminClient.clients.update({ id: clientId }, newClient);
|
||||
setupForm(newClient);
|
||||
setClient(newClient);
|
||||
|
|
|
@ -51,6 +51,7 @@ export default function NewClientForm() {
|
|||
try {
|
||||
const newClient = await adminClient.clients.create({
|
||||
...client,
|
||||
clientId: client.clientId?.trim(),
|
||||
attributes,
|
||||
});
|
||||
addAlert(t("createSuccess"), AlertVariant.success);
|
||||
|
|
|
@ -38,6 +38,8 @@ export const GroupsModal = ({
|
|||
});
|
||||
|
||||
const submitForm = async (group: GroupRepresentation) => {
|
||||
group.name = group.name?.trim();
|
||||
|
||||
try {
|
||||
if (!id) {
|
||||
await adminClient.groups.create(group);
|
||||
|
|
|
@ -120,6 +120,9 @@ export default function RealmRoleTabs() {
|
|||
}
|
||||
const { attributes, ...rest } = values;
|
||||
let roleRepresentation: RoleRepresentation = rest;
|
||||
|
||||
roleRepresentation.name = roleRepresentation.name?.trim();
|
||||
|
||||
if (id) {
|
||||
if (attributes) {
|
||||
roleRepresentation.attributes = arrayToAttributes(attributes);
|
||||
|
|
|
@ -81,6 +81,8 @@ const UsersTabs = () => {
|
|||
};
|
||||
|
||||
const save = async (user: UserRepresentation) => {
|
||||
user.username = user.username?.trim();
|
||||
|
||||
try {
|
||||
if (id) {
|
||||
await adminClient.users.update({ id }, user);
|
||||
|
@ -99,7 +101,7 @@ const UsersTabs = () => {
|
|||
history.push(toUser({ id: createdUser.id, realm, tab: "settings" }));
|
||||
}
|
||||
} catch (error) {
|
||||
addError("userCreateError", error);
|
||||
addError("users:userCreateError", error);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue