]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - extensions/ConfirmEdit/ReCaptcha/ReCaptchaAuthenticationRequest.php
MediaWiki 1.30.2
[autoinstalls/mediawiki.git] / extensions / ConfirmEdit / ReCaptcha / ReCaptchaAuthenticationRequest.php
1 <?php
2
3 use MediaWiki\Auth\AuthenticationRequest;
4
5 /**
6  * Authentication request for ReCaptcha v1. Unlike the parent class, no session storage is used;
7  * that's handled by Google.
8  */
9 class ReCaptchaAuthenticationRequest extends CaptchaAuthenticationRequest {
10         public function __construct() {
11                 parent::__construct( null, null );
12         }
13
14         public function loadFromSubmission( array $data ) {
15                 // unhack the hack in parent
16                 return AuthenticationRequest::loadFromSubmission( $data );
17         }
18
19         public function getFieldInfo() {
20                 $fieldInfo = parent::getFieldInfo();
21                 if ( !$fieldInfo ) {
22                         return false;
23                 }
24
25                 return array_merge( $fieldInfo, [
26                         'captchaId' => [
27                                 'type' => 'string',
28                                 'label' => wfMessage( 'recaptcha-id-label' ),
29                                 'help' => wfMessage( 'recaptcha-id-help' ),
30                         ],
31                         'captchaWord' => [
32                                 'type' => 'string',
33                                 'label' => wfMessage( 'recaptcha-label' ),
34                                 'help' => wfMessage( 'recaptcha-help' ),
35                         ],
36                 ] );
37         }
38 }