diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php |
first commit
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' ), + ], + ]; + } +} |