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 {
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 \
-t "${BACKEND_IMAGE}:${IMAGE_TAG}" \
backend

View File

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