Commit 4546db73 authored by tom's avatar tom

[skip ci] disable email field on profile page

parent 7141aa3c
...@@ -81,13 +81,16 @@ const MyProfileEmail = ({ profileQuery }: Props) => { ...@@ -81,13 +81,16 @@ const MyProfileEmail = ({ profileQuery }: Props) => {
onSubmit={ formApi.handleSubmit(onFormSubmit) } onSubmit={ formApi.handleSubmit(onFormSubmit) }
> >
<MyProfileFieldsName/> <MyProfileFieldsName/>
<MyProfileFieldsEmail isReadOnly={ !config.services.reCaptchaV3.siteKey } defaultValue={ profileQuery.data?.email || undefined }/> <MyProfileFieldsEmail
{ config.services.reCaptchaV3.siteKey && ( isReadOnly={ !config.services.reCaptchaV3.siteKey || Boolean(profileQuery.data?.email) }
defaultValue={ profileQuery.data?.email || undefined }
/>
{ config.services.reCaptchaV3.siteKey && !profileQuery.data?.email && (
<GoogleReCaptchaProvider reCaptchaKey={ config.services.reCaptchaV3.siteKey }> <GoogleReCaptchaProvider reCaptchaKey={ config.services.reCaptchaV3.siteKey }>
<FormFieldReCaptcha/> <FormFieldReCaptcha/>
</GoogleReCaptchaProvider> </GoogleReCaptchaProvider>
) } ) }
{ config.services.reCaptchaV3.siteKey && ( { config.services.reCaptchaV3.siteKey && !profileQuery.data?.email && (
<Button <Button
mt={ 6 } mt={ 6 }
size="sm" size="sm"
......
...@@ -16,7 +16,7 @@ const MyProfileFieldsName = () => { ...@@ -16,7 +16,7 @@ const MyProfileFieldsName = () => {
const isDisabled = formState.isSubmitting; const isDisabled = formState.isSubmitting;
return ( return (
<FormControl variant="floating" isDisabled={ isDisabled } size="md" cursor="not-allowed" mb={ 3 }> <FormControl variant="floating" isDisabled={ isDisabled } size="md" mb={ 3 }>
<Input <Input
{ ...field } { ...field }
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
......
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