{"id":466269,"date":"2025-07-07T15:22:48","date_gmt":"2025-07-07T15:22:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=466269"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=466269","title":{"rendered":"<span>\u041f\u0440\u043e\u0449\u0430\u0439, reCAPTCHA! \u041a\u0430\u043a \u044f \u0437\u0430\u0449\u0438\u0442\u0438\u043b \u0444\u043e\u0440\u043c\u044b \u0432\u0445\u043e\u0434\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u0438 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0439 CAPTCHA \u043e\u0442 Cloudflare<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <a href=\"https:\/\/peakline.org\" rel=\"noopener noreferrer nofollow\">Peakline<\/a> \u2014 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f Strava. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f <strong>Cloudflare Turnstile<\/strong> \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 FastAPI. \u042d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043c\u043d\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0437\u043e\u0439\u043b\u0438\u0432\u044b\u0445 CAPTCHA, \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043e\u043f\u044b\u0442 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u0445\u043e\u0434\u0430 \u043e\u0442 \u0431\u043e\u0442\u043e\u0432.<\/p>\n<h3>\u0411\u043e\u043b\u044c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 CAPTCHA<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u0432\u0432\u043e\u0434\u0438\u043b \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u043d\u0438\u043c\u0438: &#171;\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0441\u0435 \u0441\u0432\u0435\u0442\u043e\u0444\u043e\u0440\u044b&#187;, &#171;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442&#187;, &#171;\u042f \u043d\u0435 \u0440\u043e\u0431\u043e\u0442&#187;. \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 CAPTCHA, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e reCAPTCHA \u043e\u0442 Google, \u0441\u0442\u0430\u043b\u0438 \u0441\u0438\u043d\u043e\u043d\u0438\u043c\u043e\u043c \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041e\u043d\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c, \u043d\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0431\u0438\u0440\u0430\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0414\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0433\u0434\u0435 \u0432\u0430\u0436\u0435\u043d \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435, \u0442\u0430\u043a\u043e\u0439 \u0431\u0430\u0440\u044c\u0435\u0440 \u0431\u044b\u043b \u043d\u0435\u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c. \u042f \u0438\u0441\u043a\u0430\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0431\u044b:<\/p>\n<ul>\n<li>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c<\/strong> \u043f\u0440\u043e\u0442\u0438\u0432 \u0431\u043e\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u044b\u043c<\/strong> \u0434\u043b\u044f \u043b\u0435\u0433\u0438\u0442\u0438\u043c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0441\u0442\u044b\u043c<\/strong> \u0432 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u044f \u0435\u0433\u043e \u043d\u0430\u0448\u0435\u043b.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/24e\/b8c\/111\/24eb8c111269e50487939aea00c93e86.png\" width=\"1113\" height=\"348\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/24e\/b8c\/111\/24eb8c111269e50487939aea00c93e86.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/24e\/b8c\/111\/24eb8c111269e50487939aea00c93e86.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Cloudflare Turnstile?<\/h3>\n<p><strong>Turnstile<\/strong> \u2014 \u044d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 CAPTCHA \u043e\u0442 Cloudflare. \u0415\u0433\u043e \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0438\u0448\u043a\u0430 \u2014 \u043e\u043d \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0440\u0435\u0448\u0430\u0442\u044c \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e Turnstile \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u043d\u0435\u0438\u043d\u0442\u0440\u0443\u0437\u0438\u0432\u043d\u044b\u0445 JavaScript-\u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u042d\u0442\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Cloudflare, \u0433\u0434\u0435 \u0443\u043c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442, \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438 \u0438\u043b\u0438 \u0431\u043e\u0442.<\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p><strong>\u041d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/strong> \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0437\u0430 \u0434\u043e\u043b\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043b\u0438\u043a\u043e\u0432 \u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/strong> Turnstile \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 cookie \u0438 \u043d\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u0439\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0445 \u043f\u0440\u043e\u0444\u0438\u043b\u0435\u0439, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 reCAPTCHA.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438:<\/strong> \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c Turnstile \u043d\u0430 \u0441\u0430\u0439\u0442 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0437\u0430 5 \u043c\u0438\u043d\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0441\u0442\u044c:<\/strong> \u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u0435\u043d \u0434\u043b\u044f \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0428\u0430\u0433 1: \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043b\u044e\u0447\u0438 (Site Key \u0438 Secret Key) \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Cloudflare. \u042d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u0441\u0430\u0439\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Cloudflare.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cfb\/949\/f34\/cfb949f34df909bb5163c49641bd0286.png\" width=\"1164\" height=\"1106\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/cfb\/949\/f34\/cfb949f34df909bb5163c49641bd0286.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cfb\/949\/f34\/cfb949f34df909bb5163c49641bd0286.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0438\u0434\u0436\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 (<code>register.html<\/code>) \u0438 \u0432\u0445\u043e\u0434\u0430 (<code>email_login.html<\/code>). \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 Jinja2, \u043d\u043e \u043b\u043e\u0433\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430.<\/p>\n<p><strong>1. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442.<\/strong> \u0412 \u0441\u0435\u043a\u0446\u0438\u044e &lt;head&gt;   \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 Turnstile.<\/p>\n<pre><code class=\"markdown\">&lt;script src=\"https:\/\/challenges.cloudflare.com\/turnstile\/v0\/api.js\" async defer&gt;&lt;\/script&gt;<\/code><\/pre>\n<p><strong>2. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0438\u0434\u0436\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0443.<\/strong> \u0412\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 <code>&lt;form&gt;<\/code> \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c <code>div<\/code>-\u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u043c.<\/p>\n<pre><code class=\"markdown\">&lt;form id=\"login-form\"&gt;     &lt;!-- \u041f\u043e\u043b\u044f \u0434\u043b\u044f email \u0438 \u043f\u0430\u0440\u043e\u043b\u044f --&gt;     &lt;div class=\"form-group\"&gt;         &lt;label for=\"email\" class=\"form-label\"&gt;Email&lt;\/label&gt;         &lt;input type=\"email\" id=\"email\" name=\"email\" class=\"form-input\" required&gt;     &lt;\/div&gt;     &lt;div class=\"form-group\"&gt;         &lt;label for=\"password\" class=\"form-label\"&gt;\u041f\u0430\u0440\u043e\u043b\u044c&lt;\/label&gt;         &lt;input type=\"password\" id=\"password\" name=\"password\" class=\"form-input\" required&gt;     &lt;\/div&gt;      &lt;!-- \u0412\u043e\u0442 \u0438 \u0441\u0430\u043c\u0430 \u043a\u0430\u043f\u0447\u0430! --&gt;     &lt;div class=\"cf-turnstile\"          data-sitekey=\"{{ TURNSTILE_SITE_KEY }}\"          data-theme=\"auto\"&gt;     &lt;\/div&gt;      &lt;button type=\"submit\" class=\"btn btn-primary\"&gt;\u0412\u043e\u0439\u0442\u0438&lt;\/button&gt; &lt;\/form&gt;<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>data-sitekey<\/code>. \u042f \u043f\u0435\u0440\u0435\u0434\u0430\u044e \u0435\u0433\u043e \u0438\u0437 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 &#171;\u0437\u0430\u0448\u0438\u0432\u0430\u0442\u044c&#187; \u043a\u043b\u044e\u0447 \u043f\u0440\u044f\u043c\u043e \u0432 HTML. <code>data-theme=\"auto\"<\/code> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u0438\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u043f\u043e\u0434 \u0441\u0432\u0435\u0442\u043b\u0443\u044e \u0438\u043b\u0438 \u0442\u0435\u043c\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0443, Turnstile \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u043f\u043e\u043b\u0435 <code>cf-turnstile-response<\/code>. \u041c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JavaScript \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434.<\/p>\n<pre><code class=\"javascript\">document.getElementById('login-form').addEventListener('submit', async (e) =&amp;gt; {     e.preventDefault();      const formData = new FormData(e.target);     const data = {         email: formData.get('email'),         password: formData.get('password'),         \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u043e\u0442 \u0432\u0438\u0434\u0436\u0435\u0442\u0430         \"cf-turnstile-response\": formData.get('cf-turnstile-response')     };      \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043d\u0430\u0448 API     await fetch('\/api\/auth\/login', {         method: 'POST',         headers: { 'Content-Type': 'application\/json' },         body: JSON.stringify(data)     }); });<\/code><\/pre>\n<p>\u0424\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0433\u043e\u0442\u043e\u0432!<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ae\/e24\/a6c\/2aee24a6c01814f510c287cdc8d9192d.png\" width=\"707\" height=\"845\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/2ae\/e24\/a6c\/2aee24a6c01814f510c287cdc8d9192d.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ae\/e24\/a6c\/2aee24a6c01814f510c287cdc8d9192d.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h3>\u0428\u0430\u0433 2: \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u0435 (FastAPI)<\/h3>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u041c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d <code>cf-turnstile-response<\/code> \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 Cloudflare \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/p>\n<p><strong>1. \u041c\u043e\u0434\u0435\u043b\u0438 Pydantic.<\/strong> \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Pydantic \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0445\u043e\u0434\u0430 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">from pydantic import BaseModel, Field  class EmailLogin(BaseModel):     email: str     password: str     cf_turnstile_response: str = Field(..., alias=\"cf-turnstile-response\")  class EmailRegistration(BaseModel):     email: str     password: str     # ... \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044f     cf_turnstile_response: str = Field(..., alias=\"cf-turnstile-response\") <\/code><\/pre>\n<p><strong>2. \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/strong> \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a API Cloudflare. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>aiohttp<\/code>.<\/p>\n<pre><code class=\"python\">import os import aiohttp from loguru import logger # \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e loguru \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f  async def verify_turnstile(token: str, ip: str) -&amp;gt; bool:     \"\"\"\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u043e\u043a\u0435\u043d Cloudflare Turnstile.\"\"\"     secret_key = os.getenv(\"TURNSTILE_SECRET_KEY\")     if not secret_key:         logger.error(\"TURNSTILE_SECRET_KEY is not set. Skipping validation.\")         # \u0412 \u043f\u0440\u043e\u0434\u0435 \u0437\u0434\u0435\u0441\u044c \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c False         return True      payload = {         \"secret\": secret_key,         \"response\": token,         \"remoteip\": ip     }      try:         async with aiohttp.ClientSession() as session:             async with session.post(\"https:\/\/challenges.cloudflare.com\/turnstile\/v0\/siteverify\", data=payload) as response:                 if response.status == 200:                     result = await response.json()                     if result.get(\"success\"):                         logger.info(f\"Turnstile validation successful for IP: {ip}\")                         return True                     else:                         logger.warning(f\"Turnstile validation failed for IP: {ip}. Errors: {result.get('error-codes')}\")                         return False                 else:                     logger.error(f\"Failed to verify Turnstile token. Status: {response.status}\")                     return False     except Exception as e:         logger.exception(f\"An exception occurred during Turnstile verification: {e}\")         return False <\/code><\/pre>\n<p><strong>3. \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b.<\/strong> \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043d\u0430\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u0445\u043e\u0434\u0430.<\/p>\n<pre><code class=\"python\">from fastapi import FastAPI, Request, HTTPException  app = FastAPI()  @app.post(\"\/api\/auth\/login\") async def login_email_user(request: Request, login_data: EmailLogin):     \"\"\"\u0412\u0445\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e email \u0438 \u043f\u0430\u0440\u043e\u043b\u044e \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 Turnstile.\"\"\"      # \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 CAPTCHA!     if not await verify_turnstile(login_data.cf_turnstile_response, request.client.host):         raise HTTPException(status_code=403, detail=\"Invalid CAPTCHA. Please try again.\")      # ... \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 ...      return {\"status\": \"success\"}  @app.post(\"\/api\/auth\/register\") async def register_email_user(request: Request, registration: EmailRegistration):     \"\"\"\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 Turnstile.\"\"\"          # \u0418 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435     if not await verify_turnstile(registration.cf_turnstile_response, request.client.host):         raise HTTPException(status_code=403, detail=\"Invalid CAPTCHA. Please try again.\")      # ... \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 ...      return {\"status\": \"success\"} <\/code><\/pre>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u0444\u043e\u0440\u043c\u044b \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f Cloudflare Turnstile \u0437\u0430\u043d\u044f\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0430\u0441\u0430, \u043d\u043e \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443. \u042f \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043e\u0442 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0439 \u043a\u0430\u043f\u0447\u0438, \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0445\u043e\u0434\u0430 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u044b\u043c \u0438 \u043d\u0435 \u043f\u043e\u0436\u0435\u0440\u0442\u0432\u043e\u0432\u0430\u043b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0449\u0435\u0442\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435, \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0431\u043e\u0442\u043e\u0432 \u2014 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Turnstile.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/925310\/\"> https:\/\/habr.com\/ru\/articles\/925310\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <a href=\"https:\/\/peakline.org\" rel=\"noopener noreferrer nofollow\">Peakline<\/a> \u2014 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f Strava. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f <strong>Cloudflare Turnstile<\/strong> \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 FastAPI. \u042d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043c\u043d\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0437\u043e\u0439\u043b\u0438\u0432\u044b\u0445 CAPTCHA, \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043e\u043f\u044b\u0442 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u0445\u043e\u0434\u0430 \u043e\u0442 \u0431\u043e\u0442\u043e\u0432.<\/p>\n<h3>\u0411\u043e\u043b\u044c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 CAPTCHA<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u0432\u0432\u043e\u0434\u0438\u043b \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u043d\u0438\u043c\u0438: &#171;\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0441\u0435 \u0441\u0432\u0435\u0442\u043e\u0444\u043e\u0440\u044b&#187;, &#171;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442&#187;, &#171;\u042f \u043d\u0435 \u0440\u043e\u0431\u043e\u0442&#187;. \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 CAPTCHA, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e reCAPTCHA \u043e\u0442 Google, \u0441\u0442\u0430\u043b\u0438 \u0441\u0438\u043d\u043e\u043d\u0438\u043c\u043e\u043c \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041e\u043d\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c, \u043d\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0431\u0438\u0440\u0430\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0414\u043b\u044f \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0433\u0434\u0435 \u0432\u0430\u0436\u0435\u043d \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435, \u0442\u0430\u043a\u043e\u0439 \u0431\u0430\u0440\u044c\u0435\u0440 \u0431\u044b\u043b \u043d\u0435\u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c. \u042f \u0438\u0441\u043a\u0430\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0431\u044b:<\/p>\n<ul>\n<li>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c<\/strong> \u043f\u0440\u043e\u0442\u0438\u0432 \u0431\u043e\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u044b\u043c<\/strong> \u0434\u043b\u044f \u043b\u0435\u0433\u0438\u0442\u0438\u043c\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0441\u0442\u044b\u043c<\/strong> \u0432 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u044f \u0435\u0433\u043e \u043d\u0430\u0448\u0435\u043b.<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Cloudflare Turnstile?<\/h3>\n<p><strong>Turnstile<\/strong> \u2014 \u044d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 CAPTCHA \u043e\u0442 Cloudflare. \u0415\u0433\u043e \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0438\u0448\u043a\u0430 \u2014 \u043e\u043d \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0440\u0435\u0448\u0430\u0442\u044c \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e Turnstile \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u043d\u0435\u0438\u043d\u0442\u0440\u0443\u0437\u0438\u0432\u043d\u044b\u0445 JavaScript-\u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u042d\u0442\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Cloudflare, \u0433\u0434\u0435 \u0443\u043c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442, \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c\u0438 \u0438\u043b\u0438 \u0431\u043e\u0442.<\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p><strong>\u041d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/strong> \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0437\u0430 \u0434\u043e\u043b\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043b\u0438\u043a\u043e\u0432 \u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/strong> Turnstile \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 cookie \u0438 \u043d\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0441\u0430\u0439\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0445 \u043f\u0440\u043e\u0444\u0438\u043b\u0435\u0439, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 reCAPTCHA.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438:<\/strong> \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c Turnstile \u043d\u0430 \u0441\u0430\u0439\u0442 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0437\u0430 5 \u043c\u0438\u043d\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0441\u0442\u044c:<\/strong> \u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u0435\u043d \u0434\u043b\u044f \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0428\u0430\u0433 1: \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043b\u044e\u0447\u0438 (Site Key \u0438 Secret Key) \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Cloudflare. \u042d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u0441\u0430\u0439\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Cloudflare.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0438\u0434\u0436\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 (<code>register.html<\/code>) \u0438 \u0432\u0445\u043e\u0434\u0430 (<code>email_login.html<\/code>). \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 Jinja2, \u043d\u043e \u043b\u043e\u0433\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430.<\/p>\n<p><strong>1. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442.<\/strong> \u0412 \u0441\u0435\u043a\u0446\u0438\u044e &lt;head&gt;   \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 Turnstile.<\/p>\n<pre><code class=\"markdown\">&lt;script src=\"https:\/\/challenges.cloudflare.com\/turnstile\/v0\/api.js\" async defer&gt;&lt;\/script&gt;<\/code><\/pre>\n<p><strong>2. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0438\u0434\u0436\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0443.<\/strong> \u0412\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 <code>&lt;form&gt;<\/code> \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c <code>div<\/code>-\u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u043c.<\/p>\n<pre><code class=\"markdown\">&lt;form id=\"login-form\"&gt;     &lt;!-- \u041f\u043e\u043b\u044f \u0434\u043b\u044f email \u0438 \u043f\u0430\u0440\u043e\u043b\u044f --&gt;     &lt;div class=\"form-group\"&gt;         &lt;label for=\"email\" class=\"form-label\"&gt;Email&lt;\/label&gt;         &lt;input type=\"email\" id=\"email\" name=\"email\" class=\"form-input\" required&gt;     &lt;\/div&gt;     &lt;div class=\"form-group\"&gt;         &lt;label for=\"password\" class=\"form-label\"&gt;\u041f\u0430\u0440\u043e\u043b\u044c&lt;\/label&gt;         &lt;input type=\"password\" id=\"password\" name=\"password\" class=\"form-input\" required&gt;     &lt;\/div&gt;      &lt;!-- \u0412\u043e\u0442 \u0438 \u0441\u0430\u043c\u0430 \u043a\u0430\u043f\u0447\u0430! --&gt;     &lt;div class=\"cf-turnstile\"          data-sitekey=\"{{ TURNSTILE_SITE_KEY }}\"          data-theme=\"auto\"&gt;     &lt;\/div&gt;      &lt;button type=\"submit\" class=\"btn btn-primary\"&gt;\u0412\u043e\u0439\u0442\u0438&lt;\/button&gt; &lt;\/form&gt;<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>data-sitekey<\/code>. \u042f \u043f\u0435\u0440\u0435\u0434\u0430\u044e \u0435\u0433\u043e \u0438\u0437 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 &#171;\u0437\u0430\u0448\u0438\u0432\u0430\u0442\u044c&#187; \u043a\u043b\u044e\u0447 \u043f\u0440\u044f\u043c\u043e \u0432 HTML. <code>data-theme=\"auto\"<\/code> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u0438\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u043f\u043e\u0434 \u0441\u0432\u0435\u0442\u043b\u0443\u044e \u0438\u043b\u0438 \u0442\u0435\u043c\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0443, Turnstile \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0441\u043a\u0440\u044b\u0442\u043e\u0435 \u043f\u043e\u043b\u0435 <code>cf-turnstile-response<\/code>. \u041c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JavaScript \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434.<\/p>\n<pre><code class=\"javascript\">document.getElementById('login-form').addEventListener('submit', async (e) =&amp;gt; {     e.preventDefault();      const formData = new FormData(e.target);     const data = {         email: formData.get('email'),         password: formData.get('password'),         \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u043e\u0442 \u0432\u0438\u0434\u0436\u0435\u0442\u0430         \"cf-turnstile-response\": formData.get('cf-turnstile-response')     };      \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043d\u0430\u0448 API     await fetch('\/api\/auth\/login', {         method: 'POST',         headers: { 'Content-Type': 'application\/json' },         body: JSON.stringify(data)     }); });<\/code><\/pre>\n<p>\u0424\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0433\u043e\u0442\u043e\u0432!<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0428\u0430\u0433 2: \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u0435 (FastAPI)<\/h3>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u041c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d <code>cf-turnstile-response<\/code> \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 Cloudflare \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/p>\n<p><strong>1. \u041c\u043e\u0434\u0435\u043b\u0438 Pydantic.<\/strong> \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Pydantic \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0445\u043e\u0434\u0430 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">from pydantic import BaseModel, Field  class EmailLogin(BaseModel):     email: str     password: str     cf_turnstile_response: str = Field(..., alias=\"cf-turnstile-response\")  class EmailRegistration(BaseModel):     email: str     password: str     # ... \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044f     cf_turnstile_response: str = Field(..., alias=\"cf-turnstile-response\") <\/code><\/pre>\n<p><strong>2. \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/strong> \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a API Cloudflare. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>aiohttp<\/code>.<\/p>\n<pre><code class=\"python\">import os import aiohttp from loguru import logger # \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e loguru \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f  async def verify_turnstile(token: str, ip: str) -&amp;gt; bool:     \"\"\"\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u043e\u043a\u0435\u043d Cloudflare Turnstile.\"\"\"     secret_key = os.getenv(\"TURNSTILE_SECRET_KEY\")     if not secret_key:         logger.error(\"TURNSTILE_SECRET_KEY is not set. Skipping validation.\")         # \u0412 \u043f\u0440\u043e\u0434\u0435 \u0437\u0434\u0435\u0441\u044c \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c False         return True      payload = {         \"secret\": secret_key,         \"response\": token,         \"remoteip\": ip     }      try:         async with aiohttp.ClientSession() as session:             async with session.post(\"https:\/\/challenges.cloudflare.com\/turnstile\/v0\/siteverify\", data=payload) as response:                 if response.status == 200:                     result = await response.json()                     if result.get(\"success\"):                         logger.info(f\"Turnstile validation successful for IP: {ip}\")                         return True                     else:                         logger.warning(f\"Turnstile validation failed for IP: {ip}. Errors: {result.get('error-codes')}\")                         return False                 else:                     logger.error(f\"Failed to verify Turnstile token. Status: {response.status}\")                     return False     except Exception as e:         logger.exception(f\"An exception occurred during Turnstile verification: {e}\")         return False <\/code><\/pre>\n<p><strong>3. \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b.<\/strong> \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043d\u0430\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u0445\u043e\u0434\u0430.<\/p>\n<pre><code class=\"python\">from fastapi import FastAPI, Request, HTTPException  app = FastAPI()  @app.post(\"\/api\/auth\/login\") async def login_email_user(request: Request, login_data: EmailLogin):     \"\"\"\u0412\u0445\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e email \u0438 \u043f\u0430\u0440\u043e\u043b\u044e \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 Turnstile.\"\"\"      # \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 CAPTCHA!     if not await verify_turnstile(login_data.cf_turnstile_response, request.client.host):         raise HTTPException(status_code=403, detail=\"Invalid CAPTCHA. Please try again.\")      # ... \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 ...      return {\"status\": \"success\"}  @app.post(\"\/api\/auth\/register\") async def register_email_user(request: Request, registration: EmailRegistration):     \"\"\"\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 Turnstile.\"\"\"          # \u0418 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435     if not await verify_turnstile(registration.cf_turnstile_response, request.client.host):         raise HTTPException(status_code=403, detail=\"Invalid CAPTCHA. Please try again.\")      # ... \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 ...      return {\"status\": \"success\"} <\/code><\/pre>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u0444\u043e\u0440\u043c\u044b \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f Cloudflare Turnstile \u0437\u0430\u043d\u044f\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0430\u0441\u0430, \u043d\u043e \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443. \u042f \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043e\u0442 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0439 \u043a\u0430\u043f\u0447\u0438, \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0445\u043e\u0434\u0430 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043b\u0430\u0432\u043d\u044b\u043c \u0438 \u043d\u0435 \u043f\u043e\u0436\u0435\u0440\u0442\u0432\u043e\u0432\u0430\u043b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0449\u0435\u0442\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435, \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0431\u043e\u0442\u043e\u0432 \u2014 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c Turnstile.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/925310\/\"> https:\/\/habr.com\/ru\/articles\/925310\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-466269","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=466269"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466269\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=466269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}