Skip to content

Commit

Permalink
🎨 La regex bloque les script html
Browse files Browse the repository at this point in the history
  • Loading branch information
HubM committed Sep 19, 2024
1 parent 930b13f commit 235dac9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import { addQueryParams } from '../../helpers/addQueryParams';
import * as yup from 'yup';
import safeAsyncHandler from '../helpers/safeAsyncHandler';
import { EmailAlreadyUsedError } from '../../modules/shared';

const schema = yup.object({
body: yup.object({
firstname: yup
.string()
.matches(/^[A-Za-z]+$/, 'Ce champ ne doit contenir que des lettres')
.matches(/^(?!.*<.*?>).*$/, 'Ce champ ne doit pas contenir de balises HTML')
.required('Ce champ est obligatoire'),
lastname: yup
.string()
.matches(/^[A-Za-z]+$/, 'Ce champ ne doit contenir que des lettres')
.matches(/^(?!.*<.*?>).*$/, 'Ce champ ne doit pas contenir de balises HTML')
.required('Ce champ est obligatoire'),
email: yup
.string()
Expand Down
8 changes: 4 additions & 4 deletions packages/applications/legacy/src/views/pages/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ const SignupForm = ({ utilisateurInvité, email, error }: SignupFormProps) => (
type="text"
id="firstname"
name="firstname"
pattern="^[A-Za-z]*"
title="Ce champ ne peut contenir que des lettres"
pattern="^(?!.*<.*?>).+$"
title="Ce champ ne doit pas contenir de balises HTML"
required
/>
</div>
Expand All @@ -101,8 +101,8 @@ const SignupForm = ({ utilisateurInvité, email, error }: SignupFormProps) => (
type="text"
id="lastname"
name="lastname"
pattern="^[a-zA-Z]*"
title="Ce champ ne peut contenir que des lettres"
pattern="^(?!.*<.*?>).+$"
title="Ce champ ne doit pas contenir de balises HTML"
required
/>
</div>
Expand Down

0 comments on commit 235dac9

Please sign in to comment.