2016-05-03 16:42:00 +00:00
|
|
|
<?php
|
|
|
|
|
2022-04-08 16:53:12 +00:00
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\ReCaptchaNoCaptcha;
|
|
|
|
|
2016-05-03 16:42:00 +00:00
|
|
|
use MediaWiki\Auth\AuthenticationRequest;
|
2022-04-08 16:40:15 +00:00
|
|
|
use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest;
|
2016-05-03 16:42:00 +00:00
|
|
|
|
|
|
|
/**
|
2024-10-25 18:24:07 +00:00
|
|
|
* Authentication request for ReCaptcha v2. Unlike the parent class, no session storage is used,
|
2016-05-03 16:42:00 +00:00
|
|
|
* and there is no ID; Google provides a single proof string after successfully solving a captcha.
|
|
|
|
*/
|
|
|
|
class ReCaptchaNoCaptchaAuthenticationRequest extends CaptchaAuthenticationRequest {
|
|
|
|
public function __construct() {
|
2019-12-03 17:08:13 +00:00
|
|
|
parent::__construct( '', [] );
|
2016-05-03 16:42:00 +00:00
|
|
|
}
|
|
|
|
|
2024-10-25 18:24:07 +00:00
|
|
|
/** @inheritDoc */
|
2016-05-03 16:42:00 +00:00
|
|
|
public function loadFromSubmission( array $data ) {
|
|
|
|
// unhack the hack in parent
|
|
|
|
return AuthenticationRequest::loadFromSubmission( $data );
|
|
|
|
}
|
|
|
|
|
2024-10-25 18:24:07 +00:00
|
|
|
/** @inheritDoc */
|
2016-05-03 16:42:00 +00:00
|
|
|
public function getFieldInfo() {
|
|
|
|
$fieldInfo = parent::getFieldInfo();
|
|
|
|
|
|
|
|
return [
|
|
|
|
'captchaWord' => [
|
|
|
|
'type' => 'string',
|
|
|
|
'label' => $fieldInfo['captchaInfo']['label'],
|
|
|
|
'help' => wfMessage( 'renocaptcha-help' ),
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|