1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-17 11:28:41 +01:00

config.php: ops, wrong name for the native captcha

This commit is contained in:
Zankaria 2024-08-15 16:33:56 +02:00
parent f7073d5d7e
commit 165ea5308a
4 changed files with 13 additions and 13 deletions

View File

@ -352,7 +352,7 @@
$config['simple_spam'] = false; $config['simple_spam'] = false;
$config['captcha'] = [ $config['captcha'] = [
// Can be false, 'recaptcha', 'hcaptcha' or 'secureimage'. // Can be false, 'recaptcha', 'hcaptcha' or 'native'.
'provider' => false, 'provider' => false,
/* /*
* If not false, the captcha is dynamically injected on the client if the web server set the `captcha-required` * If not false, the captcha is dynamically injected on the client if the web server set the `captcha-required`
@ -372,8 +372,8 @@
'sitekey' => '10000000-ffff-ffff-ffff-000000000001', 'sitekey' => '10000000-ffff-ffff-ffff-000000000001',
'secret' => '0x0000000000000000000000000000000000000000', 'secret' => '0x0000000000000000000000000000000000000000',
], ],
// Enable the secureimage captcha you need to change a couple of settings. Read more at: /inc/captcha/readme.md // To enable the native captcha you need to change a couple of settings. Read more at: /inc/captcha/readme.md
'secureimage' => [ 'native' => [
// Custom captcha get provider path (if not working get the absolute path aka your url). // Custom captcha get provider path (if not working get the absolute path aka your url).
'provider_get' => '../inc/captcha/entrypoint.php', 'provider_get' => '../inc/captcha/entrypoint.php',
// Custom captcha check provider path // Custom captcha check provider path

View File

@ -76,14 +76,14 @@ function build_context(array $config): Context {
}, },
NativeCaptchaQuery::class => function($c) { NativeCaptchaQuery::class => function($c) {
$config = $c->get('config'); $config = $c->get('config');
if ($config['captcha']['provider'] !== 'secureimage') { if ($config['captcha']['provider'] !== 'native') {
throw new RuntimeException('No native captcha service available'); throw new RuntimeException('No native captcha service available');
} }
return new NativeCaptchaQuery( return new NativeCaptchaQuery(
$c->get(HttpDriver::class), $c->get(HttpDriver::class),
$config['domain'], $config['domain'],
$config['captcha']['secureimage']['provider_check'], $config['captcha']['native']['provider_check'],
$config['captcha']['secureimage']['extra'] $config['captcha']['native']['extra']
); );
} }
]); ]);

View File

@ -630,12 +630,12 @@ if (isset($_POST['delete'])) {
// Check for CAPTCHA right after opening the board so the "return" link is in there. // Check for CAPTCHA right after opening the board so the "return" link is in there.
try { try {
$provider = $config['captcha']['provider']; $provider = $config['captcha']['provider'];
$new_thread_capt = $config['captcha']['secureimage']['new_thread_capt']; $new_thread_capt = $config['captcha']['native']['new_thread_capt'];
$dynamic = $config['captcha']['dynamic']; $dynamic = $config['captcha']['dynamic'];
// With our custom captcha provider // With our custom captcha provider
if (($provider === 'secureimage' && !$new_thread_capt) if (($provider === 'native' && !$new_thread_capt)
|| ($provider === 'secureimage' && $new_thread_capt && $post['op'])) { || ($provider === 'native' && $new_thread_capt && $post['op'])) {
$query = $context->get(NativeCaptchaQuery::class); $query = $context->get(NativeCaptchaQuery::class);
$success = $query->verify($_POST['captcha_text'], $_POST['captcha_cookie']); $success = $query->verify($_POST['captcha_text'], $_POST['captcha_cookie']);

View File

@ -106,11 +106,11 @@
{% trans %}Verification{% endtrans %} {% trans %}Verification{% endtrans %}
</th> </th>
<td> <td>
<script>load_captcha("{{ config.captcha.secureimage.provider_get }}", "{{ config.secureimage.captcha.extra }}");</script> <script>load_captcha("{{ config.captcha.native.provider_get }}", "{{ config.native.captcha.extra }}");</script>
<noscript> <noscript>
<input class='captcha_text' type='text' name='captcha_text' size='32' maxlength='6' autocomplete='off'> <input class='captcha_text' type='text' name='captcha_text' size='32' maxlength='6' autocomplete='off'>
<div class="captcha_html"> <div class="captcha_html">
<img src="/{{ config.captcha.secureimage.provider_get }}?mode=get&raw=1"> <img src="/{{ config.captcha.native.provider_get }}?mode=get&raw=1">
</div> </div>
</noscript> </noscript>
</td> </td>
@ -122,11 +122,11 @@
{% trans %}Verification{% endtrans %} {% trans %}Verification{% endtrans %}
</th> </th>
<td> <td>
<script>load_captcha("{{ config.captcha.secureimage.provider_get }}", "{{ config.captcha.secureimage.extra }}");</script> <script>load_captcha("{{ config.captcha.native.provider_get }}", "{{ config.captcha.native.extra }}");</script>
<noscript> <noscript>
<input class='captcha_text' type='text' name='captcha_text' size='32' maxlength='6' autocomplete='off'> <input class='captcha_text' type='text' name='captcha_text' size='32' maxlength='6' autocomplete='off'>
<div class="captcha_html"> <div class="captcha_html">
<img src="/{{ config.captcha.secureimage.provider_get }}?mode=get&raw=1"> <img src="/{{ config.captcha.native.provider_get }}?mode=get&raw=1">
</div> </div>
</noscript> </noscript>
</td> </td>