Commit d2682889 authored by tom's avatar tom

fix verified email checkmark behaviour

parent 3eefec5d
......@@ -81,7 +81,7 @@ const MyProfileEmail = ({ profileQuery }: Props) => {
onSubmit={ formApi.handleSubmit(onFormSubmit) }
>
<MyProfileFieldsName/>
<MyProfileFieldsEmail isReadOnly={ !config.services.reCaptchaV3.siteKey }/>
<MyProfileFieldsEmail isReadOnly={ !config.services.reCaptchaV3.siteKey } defaultValue={ profileQuery.data?.email || undefined }/>
{ config.services.reCaptchaV3.siteKey && (
<GoogleReCaptchaProvider reCaptchaKey={ config.services.reCaptchaV3.siteKey }>
<FormFieldReCaptcha/>
......
......@@ -10,9 +10,10 @@ import InputPlaceholder from 'ui/shared/InputPlaceholder';
interface Props {
isReadOnly?: boolean;
defaultValue: string | undefined;
}
const MyProfileFieldsEmail = ({ isReadOnly }: Props) => {
const MyProfileFieldsEmail = ({ isReadOnly, defaultValue }: Props) => {
const { control } = useFormContext<FormFields>();
const { field, fieldState, formState } = useController<FormFields, 'email'>({
control,
......@@ -21,6 +22,7 @@ const MyProfileFieldsEmail = ({ isReadOnly }: Props) => {
});
const isDisabled = formState.isSubmitting;
const isVerified = defaultValue && field.value === defaultValue;
return (
<FormControl variant="floating" isDisabled={ isDisabled } isRequired size="md">
......@@ -34,7 +36,7 @@ const MyProfileFieldsEmail = ({ isReadOnly }: Props) => {
autoComplete="off"
/>
<InputPlaceholder text="Email" error={ fieldState.error }/>
{ !formState.dirtyFields.email && (
{ isVerified && (
<InputRightElement h="100%">
<IconSvg name="certified" boxSize={ 5 } color="green.500"/>
</InputRightElement>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment