summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/ConfirmEdit/ReCaptchaNoCaptcha/ReCaptchaNoCaptchaAuthenticationRequest.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
committerYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
commitfc7369835258467bf97eb64f184b93691f9a9fd5 (patch)
treedaabd60089d2dd76d9f5fb416b005fbe159c799d /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.php30
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' ),
+ ],
+ ];
+ }
+}