]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / extensions / ConfirmEdit / ReCaptchaNoCaptcha / ReCaptchaNoCaptchaAuthenticationRequest.php
diff --git a/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php b/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php
new file mode 100644 (file)
index 0000000..01b845d
--- /dev/null
@@ -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' ),
+                       ],
+               ];
+       }
+}