diff --git a/index.html b/index.html index fbbab0c..79e10e1 100644 --- a/index.html +++ b/index.html @@ -43,6 +43,6 @@ })(); - + diff --git a/src/components/commun/Captcha.jsx b/src/components/commun/Captcha.jsx index 390d480..184962d 100644 --- a/src/components/commun/Captcha.jsx +++ b/src/components/commun/Captcha.jsx @@ -1,15 +1,18 @@ import React, { useEffect, useRef } from 'react'; +import PropTypes from 'prop-types'; -const SITE_KEY = '84e24b30-44ca-488c-9260-ec80c290c166'; +const SITE_KEY = '0x4AAAAAAA0pjEgohPDZsyqu'; -export default function Captcha() { +export default function Captcha({ setWidgetId }) { const captchaRef = useRef(null); useEffect(() => { - if (window.hcaptcha) { - window.hcaptcha.render(captchaRef.current, { + if (window.turnstile) { + window.turnstile.remove(); + const widgetId = window.turnstile.render(captchaRef.current, { sitekey: SITE_KEY, }); + setWidgetId(widgetId); } }, []); @@ -17,3 +20,7 @@ export default function Captcha() {
); } + +Captcha.propTypes = { + setWidgetId: PropTypes.func, +}; diff --git a/src/components/commun/Input.jsx b/src/components/commun/Input.jsx index 682c965..e972c23 100644 --- a/src/components/commun/Input.jsx +++ b/src/components/commun/Input.jsx @@ -14,7 +14,7 @@ export default function Input({ children, id, isRequired = true, autoComplete = required={isRequired} autoComplete={autoComplete} pattern={pattern} - maxlength={maxlength} + maxLength={maxlength} onChange={onChange} list={list} min={min} diff --git a/src/components/commun/ZoneDeTexte.jsx b/src/components/commun/ZoneDeTexte.jsx index 55ed95e..5c6bfc9 100644 --- a/src/components/commun/ZoneDeTexte.jsx +++ b/src/components/commun/ZoneDeTexte.jsx @@ -7,7 +7,7 @@ export default function ZoneDeTexte({ children, id, isRequired = true, maxlength - + ); } diff --git a/src/views/candidature-conseiller/AddressChooser.jsx b/src/views/candidature-conseiller/AddressChooser.jsx index 194357a..7f054f1 100644 --- a/src/views/candidature-conseiller/AddressChooser.jsx +++ b/src/views/candidature-conseiller/AddressChooser.jsx @@ -25,7 +25,7 @@ export default function AddressChooser() { - {villes.map(({ codesPostaux, nom }, key) => ( + {villes?.map(({ codesPostaux, nom }, key) => ( diff --git a/src/views/candidature-conseiller/CandidatureConseiller.jsx b/src/views/candidature-conseiller/CandidatureConseiller.jsx index d2c4c54..11926d0 100644 --- a/src/views/candidature-conseiller/CandidatureConseiller.jsx +++ b/src/views/candidature-conseiller/CandidatureConseiller.jsx @@ -25,6 +25,7 @@ export default function CandidatureConseiller() { const [dateDisponibilite, setDateDisponibilite] = useState(''); const [isSituationValid, setIsSituationValid] = useState(true); const [validationError, setValidationError] = useState(''); + const [widgetId, setWidgetId] = useState(null); const { buildConseillerData, creerCandidatureConseiller } = useApiAdmin(); const navigate = useNavigate(); @@ -57,11 +58,11 @@ export default function CandidatureConseiller() { if (resultatCreation?.status >= 400) { const error = await resultatCreation.json(); setValidationError(error.message); - window.hcaptcha.reset(); + window.turnstile.reset(widgetId); window.scrollTo({ top: 0, behavior: 'smooth' }); } else if (!resultatCreation.status) { setValidationError(resultatCreation.message); - window.hcaptcha.reset(); + window.turnstile.reset(widgetId); window.scrollTo({ top: 0, behavior: 'smooth' }); } else { navigate('/candidature-validee-conseiller'); @@ -95,7 +96,7 @@ export default function CandidatureConseiller() {
- +