Answer the question
In order to leave comments, you need to log in
Yii2. How to validate a captcha from an external cors request?
There is an external widget (form) for placement on other sites. Designed to collect applications and send them to the server.
Actually, when an external request comes to the controller in which the form is validated along with the captcha, the captcha validation does not work. I understand this because the session does not work in this case, no cookies are sent and the captcha does not work. Actually, the captcha image itself is loaded into the form via js like this:
$(".captcha").attr("src", captchaSrc + "?r=" + Math.random());
Answer the question
In order to leave comments, you need to log in
Captcha request, in response captcha + verification key (hash)
When submitting the form, we hook the user's response + key, check whether the hash matches on the server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question