Florianschmidtwelzow has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363616 )

Change subject: Fixing unexcepted HTML escaping in QuestyCaptcha.
......................................................................

Fixing unexcepted HTML escaping in QuestyCaptcha.

HTML-based questions (e.g. images) will not work well with QuestyCaptcha
on MediaWiki 1.27 due to an unexcepted HTML escape. This commit fixes the
issue by declaring raw HTML form mode, just like MathCaptcha.

Bug: T147606
Change-Id: Icc7c47b88b8aa44425acfa3d58d353ddc73bc87e
(cherry picked from commit f0932984b99868e121e2d1ecc773671572410ab2)
---
M QuestyCaptcha/QuestyCaptcha.class.php
1 file changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit 
refs/changes/16/363616/1

diff --git a/QuestyCaptcha/QuestyCaptcha.class.php 
b/QuestyCaptcha/QuestyCaptcha.class.php
index 314e15a..01f8418 100644
--- a/QuestyCaptcha/QuestyCaptcha.class.php
+++ b/QuestyCaptcha/QuestyCaptcha.class.php
@@ -8,6 +8,8 @@
  * @ingroup Extensions
  */
 
+use MediaWiki\Auth\AuthenticationRequest;
+
 class QuestyCaptcha extends SimpleCaptcha {
        // used for questycaptcha-edit, questycaptcha-addurl, 
questycaptcha-badlogin,
        // questycaptcha-createaccount, questycaptcha-create, 
questycaptcha-sendemail via getMessage()
@@ -33,7 +35,7 @@
        public function describeCaptchaType() {
                return [
                        'type' => 'question',
-                       'mime' => 'text/plain',
+                       'mime' => 'text/html',
                ];
        }
 
@@ -86,4 +88,19 @@
        public function getCaptchaInfo( $captchaData, $id ) {
                return $captchaData['question'];
        }
+
+       public function onAuthChangeFormFields( array $requests, array 
$fieldInfo,
+               array &$formDescriptor, $action ) {
+               /** @var CaptchaAuthenticationRequest $req */
+               $req =
+                       AuthenticationRequest::getRequestByClass( $requests,
+                               CaptchaAuthenticationRequest::class, true );
+               if ( !$req ) {
+                       return;
+               }
+
+               // declare RAW HTML output.
+               $formDescriptor['captchaInfo']['raw'] = true;
+               $formDescriptor['captchaWord']['label-message'] = null;
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/363616
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc7c47b88b8aa44425acfa3d58d353ddc73bc87e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: REL1_27
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Ben.imbushuo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to