From 876fcc9e6bca9341ed0e7b4fb46f5a277032a3e5 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sat, 25 Nov 2023 15:12:43 +0600 Subject: [PATCH] Add captcha validation error handling in script.js A conditional block of code was added to handle the case when 'captcha_key' is not defined. This is to manage the scenario when captcha verification fails, providing an error message to the user and thus improving user experience. --- exmplate/script.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exmplate/script.js b/exmplate/script.js index d18e4e8..733eb88 100644 --- a/exmplate/script.js +++ b/exmplate/script.js @@ -165,6 +165,11 @@ setError(errorMessage, button); return } + if (typeof data.captcha_key === 'undefined') { + setError('Произошла ошибка!', button); + return + } + shadow.querySelector('button.button-open-window-captcha').remove(); let captchaVerified = document.createElement('div'); captchaVerified.innerHTML = `Ура!!! Проверку прошли!`;