1/** 2 * Loxone Captcha â reusable Google reCAPTCHA v3 token helper. 3 * 4 * Exposes a single global: 5 * window.LoxoneCaptcha.getToken(action) -> Promise<string> 6 * 7 * `action` is an optional label for the interaction (e.g. "partner_search_request"); 8 * pass the same value to loxone_captcha_verify() on the server. 9 * 10 * When no site key is configured, getToken() resolves to an empty string so 11 * callers can submit anyway â the server side fails open in that case too. 12 */ 13(function () { 14 var config = window.LoxoneCaptchaConfig || {}; 15 var siteKey = config.siteKey || ''; 16 17 function getToken(action) { 18 action = action || 'submit'; 19 20 return new Promise(function (resolve) { 21 if (!siteKey || typeof window.grecaptcha === 'undefined') { 22 resolve(''); 23 return; 24 } 25 26 window.grecaptcha.ready(function () { 27 window.grecaptcha 28 .execute(siteKey, { action: action }) 29 .then(function (token) { 30 resolve(token || ''); 31 }) 32 .catch(function (err) { 33 // Never block submission on a captcha error â log and continue. 34 if (window.console && window.console.warn) { 35 window.console.warn('[loxone-captcha] token generation failed:', err); 36 } 37 resolve(''); 38 }); 39 }); 40 }); 41 } 42 43 window.LoxoneCaptcha = { 44 getToken: getToken, 45 siteKey: siteKey, 46 }; 47})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.