diff --git a/CHANGELOG.md b/CHANGELOG.md index b855591ae..217f591bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - Run the docker image with the system user - During the setup, autoconfigure the main domain - During the setup, ask to set ALLOW_INSECURE_HTTP if DEFAULT_PROTOCOL was set to http +- Fix a bug: the birthdate was not marked as required, in the profile edition form +- Fix a bug: when the phone or the address were required, they were not marked as this, in the profile edition form - Fix a bug: unable to set the twitter input empty - Fix a bug: unable to edit an event - Fix a bug: times are not shown in admin/events monitoring page diff --git a/app/frontend/src/javascript/components/user/user-profile-form.tsx b/app/frontend/src/javascript/components/user/user-profile-form.tsx index 1114f6876..040335ba7 100644 --- a/app/frontend/src/javascript/components/user/user-profile-form.tsx +++ b/app/frontend/src/javascript/components/user/user-profile-form.tsx @@ -28,6 +28,8 @@ import TagAPI from '../../api/tag'; import { FormMultiSelect } from '../form/form-multi-select'; import ProfileCustomFieldAPI from '../../api/profile-custom-field'; import { ProfileCustomField } from '../../models/profile-custom-field'; +import { SettingName } from '../../models/setting'; +import SettingAPI from '../../api/setting'; declare const Application: IApplication; @@ -68,6 +70,7 @@ export const UserProfileForm: React.FC = ({ action, size, const [groups, setGroups] = useState([]); const [termsAndConditions, setTermsAndConditions] = useState(null); const [profileCustomFields, setProfileCustomFields] = useState([]); + const [requiredFieldsSettings, setRequiredFieldsSettings] = useState>(new Map()); useEffect(() => { AuthProviderAPI.active().then(data => { @@ -94,6 +97,9 @@ export const UserProfileForm: React.FC = ({ action, size, }); setValue('invoicing_profile_attributes.user_profile_custom_fields_attributes', userProfileCustomFields); }).catch(error => onError(error)); + SettingAPI.query([SettingName.PhoneRequired, SettingName.AddressRequired]) + .then(settings => setRequiredFieldsSettings(settings)) + .catch(error => onError(error)); }, []); /** @@ -202,6 +208,7 @@ export const UserProfileForm: React.FC = ({ action, size, register={register} label={t('app.shared.user_profile_form.date_of_birth')} disabled={isDisabled} + rules={{ required: true }} type="date" /> = ({ action, size, pattern: { value: phoneRegex, message: t('app.shared.user_profile_form.phone_number_invalid') - } + }, + required: requiredFieldsSettings.get(SettingName.PhoneRequired) === 'true' }} disabled={isDisabled} formState={formState} @@ -222,6 +230,7 @@ export const UserProfileForm: React.FC = ({ action, size, diff --git a/app/frontend/src/stylesheets/application.scss b/app/frontend/src/stylesheets/application.scss index fea428780..0575162e7 100644 --- a/app/frontend/src/stylesheets/application.scss +++ b/app/frontend/src/stylesheets/application.scss @@ -53,7 +53,6 @@ @import "modules/payment/stripe/stripe-confirm"; @import "modules/payment/stripe/stripe-keys-form"; @import "modules/payment/stripe/stripe-modal"; -@import "modules/payment/stripe/stripe-update-card-modal"; @import "modules/plan-categories/delete-plan-category"; @import "modules/plan-categories/manage-plan-category"; @import "modules/plan-categories/plan-categories-list";