Skip to content

Commit 684460d

Browse files
committed
CaptchEtat V2
1 parent ded7732 commit 684460d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

components/CaptchEtatBundle/src/bundle/Resources/public/js/captchetat-widget.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
console.log('captchetat-widget.js')
12

23
/**
34
* @param {HTMLElement} container
@@ -40,21 +41,26 @@ export const addLinksToHead = container => {
4041

4142
// Define captchaEtat object
4243
export const captchaEtat = (function () {
44+
console.log('captchetat-widget.js captchaEtat')
4345
function _init(container = document) {
46+
console.log('captchetat-widget.js init()')
4447
const widgets = container.querySelectorAll('.js-captcha-widget');
4548

4649
for (const widget of widgets) {
4750
const htmlContainer = widget.querySelector('.captcha-html-container');
51+
console.log('htmlContainer ::', htmlContainer);
4852
const idInput = widget.querySelector('.captcha-input [name*="[captcha_id]"]');
53+
console.log('idInput ::', idInput);
54+
4955
if (htmlContainer.querySelector('.captcha-html')) {
5056
return;
5157
}
5258

5359
fetch('/api/simple-captcha').then((response) => {
5460
console.log('response ::', response);
5561
return response.text();
56-
}).then((html) => {
57-
62+
}).then((data) => {
63+
console.log('data ::', data);
5864
//__________________ add img tag
5965
const parsedData = JSON.parse(html);
6066
const imageBase64 = parsedData.imageb64;
@@ -65,7 +71,9 @@ export const captchaEtat = (function () {
6571
img.classList = "captch-etat-v2";
6672
console.log('imageBase64', imageBase64);
6773
console.log('img', img);
68-
document.getElementById('form-fre-FR-438825-1795842_fields_captcha').appendChild(img);
74+
75+
let parent = htmlContainer
76+
htmlContainer.appendChild(img);
6977
console.log('okkk ::');
7078
//__________________ add img tag
7179

components/CaptchEtatBundle/src/bundle/Resources/templates/captchetat-fields.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{% endblock captchetat_label %}
88

99
{% block captchetat_widget %}
10+
{{ dump('vendor/almaviacx/captchetatbundle/src/bundle/Resources/templates/captchetat-fields.html.twig captchetat_widget') }}
1011
{% apply spaceless %}
1112
{%- set attr = attr|merge({
1213
'class': 'widget-container row align-items-center js-captcha-widget'

0 commit comments

Comments
 (0)