`CaptchaFormField` field did not check whether the given captcha type is available
authorMarcel Werk <burntime@woltlab.com>
Mon, 2 Dec 2024 11:41:25 +0000 (12:41 +0100)
committerMarcel Werk <burntime@woltlab.com>
Mon, 2 Dec 2024 11:41:25 +0000 (12:41 +0100)
ref https://www.woltlab.com/community/thread/309908-passwort-vergessen-funktioniert-nicht/

wcfsetup/install/files/lib/system/form/builder/field/CaptchaFormField.class.php

index 40cc464b2a35262a9e6f4691ce96775379dac3ab..b21701ba818c98a57f873be1031d4808b5de7cf4 100644 (file)
@@ -126,7 +126,17 @@ final class CaptchaFormField extends AbstractFormField implements IObjectTypeFor
             return $this;
         }
 
-        return $this->defaultObjectType($objectType);
+        $this->defaultObjectType($objectType);
+
+        if ($this->objectType !== null) {
+            $captchaHandler = $this->getObjectType()->getProcessor();
+            \assert($captchaHandler instanceof ICaptchaHandler);
+            if (!$captchaHandler->isAvailable()) {
+                $this->objectType = null;
+            }
+        }
+
+        return $this;
     }
 
     /**