feat: капча Google/Cloudflare, блокировка Яндекс SmartCaptcha

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
shop
2026-05-17 14:41:45 +03:00
parent f9f0446c12
commit 9025677fd8
11 changed files with 251 additions and 0 deletions
+1
View File
@@ -10,6 +10,7 @@
Email
<input type="email" name="email" class="input" required value="<%= values.email || '' %>" autocomplete="email">
</label>
<%- include('../partials/captcha-widget') %>
<button type="submit" class="btn btn--primary btn--block">Отправить ссылку</button>
<p class="form-footer"><a href="/login">← Вход</a></p>
</form>
+1
View File
@@ -13,6 +13,7 @@
Пароль
<input type="password" name="password" class="input" required autocomplete="current-password">
</label>
<%- include('partials/captcha-widget') %>
<button type="submit" class="btn btn--primary btn--block">Войти по паролю</button>
<p class="form-footer">
<a href="/forgot-password">Забыли пароль?</a><br>
+23
View File
@@ -0,0 +1,23 @@
<aside class="captcha-block" aria-label="Защита от ботов">
<p class="captcha-block__yandex-notice">
<%- include('icon', { name: 'shield', iconSize: 14 }) %>
<%= yandexCaptchaBlockedMsg %>
</p>
<% if (captcha && captcha.blocked) { %>
<p class="alert alert--error">Капча недоступна: выбран заблокированный провайдер. В .env укажите <code>CAPTCHA_PROVIDER=google</code> или <code>cloudflare</code>.</p>
<% } else if (captcha && captcha.enabled) { %>
<div class="captcha-widget">
<% if (captcha.provider === 'cloudflare') { %>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<div class="cf-turnstile" data-sitekey="<%= captcha.siteKey %>" data-theme="dark"></div>
<% } else { %>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" data-sitekey="<%= captcha.siteKey %>" data-theme="dark"></div>
<% } %>
</div>
<p class="muted captcha-block__provider">
<% if (captcha.provider === 'cloudflare') { %>Проверка: Cloudflare Turnstile<% } else { %>Проверка: Google reCAPTCHA<% } %>
</p>
<% } %>
</aside>
+1
View File
@@ -20,6 +20,7 @@
Повторите пароль
<input type="password" name="password2" class="input" required>
</label>
<%- include('partials/captcha-widget') %>
<button type="submit" class="btn btn--primary btn--block">Создать аккаунт</button>
<p class="form-footer">Уже есть аккаунт? <a href="/login">Войти</a></p>
</form>