S
S
Sergey2016-12-18 19:52:05
Yii
Sergey, 2016-12-18 19:52:05

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());

The form is submitted via ajax. But the captcha is not validated. There are kind people, who will tell you how to make a captcha in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-12-18
@webinar

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 question

Ask a Question

731 491 924 answers to any question