Add 'Email Verified' checkbox if user profile is enabled (#24463)

This commit is contained in:
Jon Koops 2023-11-01 15:11:50 +01:00 committed by GitHub
parent be65ba8689
commit 222db659f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,11 +187,40 @@ export const UserForm = ({
</FormGroup> </FormGroup>
)} )}
{userProfileMetadata ? ( {userProfileMetadata ? (
<UserProfileFields <>
form={form} <FormGroup
userProfileMetadata={userProfileMetadata} label={t("emailVerified")}
hideReadOnly={!user} fieldId="kc-email-verified"
/> helperTextInvalid={t("required")}
labelIcon={
<HelpItem
helpText={t("emailVerifiedHelp")}
fieldLabelId="emailVerified"
/>
}
>
<Controller
name="emailVerified"
defaultValue={false}
control={control}
render={({ field }) => (
<Switch
data-testid="email-verified-switch"
id="kc-user-email-verified"
onChange={(value) => field.onChange(value)}
isChecked={field.value}
label={t("yes")}
labelOff={t("no")}
/>
)}
/>
</FormGroup>
<UserProfileFields
form={form}
userProfileMetadata={userProfileMetadata}
hideReadOnly={!user}
/>
</>
) : ( ) : (
<> <>
{!realm.registrationEmailAsUsername && ( {!realm.registrationEmailAsUsername && (