Просмотр файла resources/views/app/_captcha.blade.php

Размер файла: 1.42Kb
  1. @if (setting('captcha_type') === 'recaptcha_v2')
  2. <script src="//www.google.com/recaptcha/api.js?hl={{ app()->getLocale() }}" async defer></script>
  3. <div class="g-recaptcha" data-sitekey="{{ setting('recaptcha_public') }}"></div>
  4. <div class="invalid-feedback">{{ textError('protect') }}</div>
  5. @endif
  6.  
  7. @if (setting('captcha_type') === 'recaptcha_v3')
  8. <script src="//www.google.com/recaptcha/api.js?onload=recaptchaCallback&amp;render={{ setting('recaptcha_public') }}&amp;hl={{ app()->getLocale() }}" async defer></script>
  9. <script>
  10. function recaptchaCallback() {
  11. grecaptcha.ready(function () {
  12. grecaptcha.execute('{{ setting('recaptcha_public') }}').then(function (token) {
  13. $('#recaptchaResponse').val(token);
  14. });
  15. });
  16. }
  17. </script>
  18. <input type="hidden" name="protect" id="recaptchaResponse">
  19. @endif
  20.  
  21. @if (in_array(setting('captcha_type'), ['graphical', 'animated'], true))
  22. <div class="mb-3{{ hasError('protect') }}">
  23. <label for="protect" class="form-label">{{ __('main.verification_code') }}:</label><br>
  24. <img src="/captcha" onclick="this.src='/captcha?'+Math.random()" class="rounded cursor-pointer" alt="Captcha"><br>
  25. <input class="form-control" name="protect" id="protect" maxlength="8" autocomplete="off" required>
  26. <div class="invalid-feedback">{{ textError('protect') }}</div>
  27. </div>
  28. @endif