From 3bf08973fb878eb3f4a397dc002e2ee59c9fad89 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 12 Sep 2022 11:50:58 +0200 Subject: [PATCH] (bug) can't complete profile if phone has hyphens or spaces --- CHANGELOG.md | 1 + .../src/javascript/components/user/user-profile-form.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60944d13d..de165e726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Script to download translations from Crowdin - Fix a bug: admin and managers can't cancel or move event reservations +- Fix a bug: phone numbers with hyphens and spaces prevent profile completion when the data is provided by a SSO ## v5.4.17 2022 September 06 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 1c449c0e5..f4aedbb08 100644 --- a/app/frontend/src/javascript/components/user/user-profile-form.tsx +++ b/app/frontend/src/javascript/components/user/user-profile-form.tsx @@ -59,7 +59,7 @@ export const UserProfileForm: React.FC = ({ action, size, const { t } = useTranslation('shared'); // regular expression to validate the input fields - const phoneRegex = /^((00|\+)\d{2,3})?\d{4,14}$/; + const phoneRegex = /^((00|\+)\d{2,3})?[\d -]{4,14}$/; const urlRegex = /^(https?:\/\/)([^.]+)\.(.{2,30})(\/.*)*\/?$/; const { handleSubmit, register, control, formState, setValue, reset } = useForm({ defaultValues: { ...user } });