Turnstile: Minor cleanup

Bug: T319068
Follows-Up: I0d5a74655619975f0bf61b5b672159afe5f4fb00
Change-Id: I15c26957158f22a0b6d6abb9def0e84e73c63ddc
This commit is contained in:
Reedy 2024-01-15 20:04:46 +00:00
parent fbf6c1c7ea
commit 8d3afbd390
3 changed files with 6 additions and 7 deletions

View file

@ -49,13 +49,12 @@ class HTMLTurnstileField extends HTMLFormField {
);
Turnstile::addCSPSources( $out->getCSP() );
$output = Html::element( 'div', [
return Html::element( 'div', [
'class' => [
'cf-turnstile',
'mw-confirmedit-captcha-fail' => (bool)$this->error,
],
'data-sitekey' => $this->key,
] );
return $output;
}
}

View file

@ -2,7 +2,7 @@
namespace MediaWiki\Extension\ConfirmEdit\Turnstile;
use Config;
use MediaWiki\Config\Config;
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
class Hooks implements ResourceLoaderGetConfigVarsHook {

View file

@ -246,9 +246,9 @@ class Turnstile extends SimpleCaptcha {
$captcha = Hooks::getInstance();
$formDescriptor['captchaWord'] = [
'class' => HTMLTurnstileField::class,
'key' => $wgTurnstileSiteKey,
'error' => $captcha->getError(),
] + $formDescriptor['captchaWord'];
'class' => HTMLTurnstileField::class,
'key' => $wgTurnstileSiteKey,
'error' => $captcha->getError(),
] + $formDescriptor['captchaWord'];
}
}