summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php
blob: 01b845dd0085dd6477fd16f705aaa786a5465a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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' ),
			],
		];
	}
}