diff options
Diffstat (limited to 'www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php')
-rw-r--r-- | www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php b/www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php new file mode 100644 index 00000000..01b845dd --- /dev/null +++ b/www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php @@ -0,0 +1,30 @@ +<?php + +use MediaWiki\Auth\AuthenticationRequest; + +/** + * Authentication request for ReCaptcha v2. Unlike the parent class, no session storage is used + * and there is no ID; Google provides a single proof string after successfully solving a captcha. + */ +class ReCaptchaNoCaptchaAuthenticationRequest extends CaptchaAuthenticationRequest { + public function __construct() { + parent::__construct( null, null ); + } + + public function loadFromSubmission( array $data ) { + // unhack the hack in parent + return AuthenticationRequest::loadFromSubmission( $data ); + } + + public function getFieldInfo() { + $fieldInfo = parent::getFieldInfo(); + + return [ + 'captchaWord' => [ + 'type' => 'string', + 'label' => $fieldInfo['captchaInfo']['label'], + 'help' => wfMessage( 'renocaptcha-help' ), + ], + ]; + } +} |