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.
This commit is contained in:
parent
23b71a09c6
commit
876fcc9e6b
@ -165,6 +165,11 @@
|
|||||||
setError(errorMessage, button);
|
setError(errorMessage, button);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (typeof data.captcha_key === 'undefined') {
|
||||||
|
setError('Произошла ошибка!', button);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
shadow.querySelector('button.button-open-window-captcha').remove();
|
shadow.querySelector('button.button-open-window-captcha').remove();
|
||||||
let captchaVerified = document.createElement('div');
|
let captchaVerified = document.createElement('div');
|
||||||
captchaVerified.innerHTML = `<span class="captcha-verified">Ура!!! Проверку прошли!</span><input type="hidden" name="captcha-verified" value="${ data.captcha_key }">`;
|
captchaVerified.innerHTML = `<span class="captcha-verified">Ура!!! Проверку прошли!</span><input type="hidden" name="captcha-verified" value="${ data.captcha_key }">`;
|
||||||
|
Loading…
Reference in New Issue
Block a user