release: 1.0.10
All checks were successful
Tests / Backend - Tests skipped: 8, passed: 74
Backend Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 78.38% (551/703) * Lines of Code: 703 #### Quality Gates Summary No active quality gates.
Tests / Frontend - Lint, Tests et Build passed: 83
Frontend Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 80.90% (555/686) * Lines of Code: 686 #### Quality Gates Summary No active quality gates.
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good

This commit is contained in:
2026-09-20 01:38:42 +00:00
2 changed files with 34 additions and 17 deletions

7
Jenkinsfile vendored
View File

@@ -334,6 +334,13 @@ stage('SonarQube Quality Gate') {
steps { steps {
sh ''' sh '''
set -a
. /opt/furious-ducks/secrets/tiptop-mail.env
set +a
test -n "${TURNSTILE_SITE_KEY}"
echo "Turnstile site key chargée (longueur: ${#TURNSTILE_SITE_KEY})"
docker build \ docker build \
-t "${BACKEND_IMAGE}:${IMAGE_TAG}" \ -t "${BACKEND_IMAGE}:${IMAGE_TAG}" \
backend backend

View File

@@ -1,5 +1,5 @@
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
import { TURNSTILE_SITE_KEY } from '../config/captcha' import { CAPTCHA_ENABLED, TURNSTILE_SITE_KEY } from '../config/captcha'
const TURNSTILE_SCRIPT_ID = 'cf-turnstile-script' const TURNSTILE_SCRIPT_ID = 'cf-turnstile-script'
const TURNSTILE_SCRIPT_URL = const TURNSTILE_SCRIPT_URL =
@@ -10,7 +10,9 @@ export default function Captcha({ onToken }) {
const widgetIdRef = useRef(null) const widgetIdRef = useRef(null)
useEffect(() => { useEffect(() => {
if (!TURNSTILE_SITE_KEY || !containerRef.current) return if (!CAPTCHA_ENABLED || !TURNSTILE_SITE_KEY || !containerRef.current) {
return
}
let cancelled = false let cancelled = false
@@ -27,7 +29,7 @@ export default function Captcha({ onToken }) {
try { try {
window.turnstile.remove(widgetIdRef.current) window.turnstile.remove(widgetIdRef.current)
} catch { } catch {
// Rien à faire // Widget déjà supprimé
} }
widgetIdRef.current = null widgetIdRef.current = null
@@ -41,6 +43,7 @@ export default function Captcha({ onToken }) {
sitekey: TURNSTILE_SITE_KEY, sitekey: TURNSTILE_SITE_KEY,
language: 'fr', language: 'fr',
size: 'flexible', size: 'flexible',
appearance: 'always',
callback: (token) => { callback: (token) => {
onToken(token) onToken(token)
@@ -66,23 +69,28 @@ export default function Captcha({ onToken }) {
return return
} }
const previousCallback = window.onloadTurnstileCallback if (existingScript) {
existingScript.addEventListener('load', renderWidget, {
once: true,
})
window.onloadTurnstileCallback = () => { return () => {
previousCallback?.() cancelled = true
renderWidget() }
} }
if (!existingScript) {
const script = document.createElement('script') const script = document.createElement('script')
script.id = TURNSTILE_SCRIPT_ID script.id = TURNSTILE_SCRIPT_ID
script.src = `${TURNSTILE_SCRIPT_URL}&onload=onloadTurnstileCallback` script.src = TURNSTILE_SCRIPT_URL
script.async = true script.async = true
script.defer = true script.defer = true
script.addEventListener('load', renderWidget, {
once: true,
})
document.head.appendChild(script) document.head.appendChild(script)
}
return () => { return () => {
cancelled = true cancelled = true
@@ -94,7 +102,7 @@ export default function Captcha({ onToken }) {
try { try {
window.turnstile.remove(widgetIdRef.current) window.turnstile.remove(widgetIdRef.current)
} catch { } catch {
// Rien à faire // Widget déjà supprimé
} }
} }
@@ -102,7 +110,9 @@ export default function Captcha({ onToken }) {
} }
}, [onToken]) }, [onToken])
if (!TURNSTILE_SITE_KEY) return null if (!CAPTCHA_ENABLED || !TURNSTILE_SITE_KEY) {
return null
}
return ( return (
<div <div