feat: add "Full Name" field to user creation (#13659)

Adds the ability to specify "Full Name" (a.k.a. Name) when
creating users either via CLI or UI.
This commit is contained in:
Cian Johnston
2024-06-26 09:00:42 +01:00
committed by GitHub
parent 87ad560aff
commit 8a3592582b
33 changed files with 435 additions and 25 deletions

View File

@ -11,6 +11,7 @@ import { FormFooter } from "components/FormFooter/FormFooter";
import { FullPageForm } from "components/FullPageForm/FullPageForm";
import { Stack } from "components/Stack/Stack";
import {
displayNameValidator,
getFormHelpers,
nameValidator,
onChangeTrimmed,
@ -20,6 +21,7 @@ export const Language = {
emailLabel: "Email",
passwordLabel: "Password",
usernameLabel: "Username",
nameLabel: "Full name",
emailInvalid: "Please enter a valid email address.",
emailRequired: "Please enter an email address.",
passwordRequired: "Please enter a password.",
@ -78,6 +80,7 @@ const validationSchema = Yup.object({
otherwise: (schema) => schema,
}),
username: nameValidator(Language.usernameLabel),
name: displayNameValidator(Language.nameLabel),
login_type: Yup.string().oneOf(Object.keys(authMethodLanguage)),
});
@ -90,6 +93,7 @@ export const CreateUserForm: FC<
email: "",
password: "",
username: "",
name: "",
organization_id: organizationId,
disable_login: false,
login_type: "",
@ -124,6 +128,12 @@ export const CreateUserForm: FC<
fullWidth
label={Language.usernameLabel}
/>
<TextField
{...getFieldHelpers("name")}
autoComplete="name"
fullWidth
label={Language.nameLabel}
/>
<TextField
{...getFieldHelpers("email")}
onChange={onChangeTrimmed(form)}