Added parameter to force captcha usage for registered users
authorMarcel Werk <burntime@woltlab.com>
Tue, 24 May 2016 16:17:17 +0000 (18:17 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 24 May 2016 16:17:22 +0000 (18:17 +0200)
CHANGELOG.md
wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php

index 2a5625b33909db6679e9df7688caba20a9736a9c..821f1df8397844aeb8e16772b437d5271162f5c6 100644 (file)
@@ -52,6 +52,7 @@
 * Added users online list pagination
 * Added support for embedded youtube playlists
 * Scaled embedded youtube videos to maximum width
+* `\wcf\form\AbstractCaptchaForm`: added parameter to force captcha usage for registered users.
 
 #### CMS
 
index 4643d058fd8a4bd73f4ea989fab5247c6f44452a..dc8355e7c8a3f3481a05873bebe2c4011c9e05c5 100644 (file)
@@ -28,11 +28,17 @@ abstract class AbstractCaptchaForm extends AbstractForm {
        public $captchaObjectTypeName = CAPTCHA_TYPE;
        
        /**
-        * true if recaptcha is used
+        * true if captcha is used
         * @var boolean
         */
        public $useCaptcha = true;
        
+       /**
+        * true to force captcha usage
+        * @var boolean
+        */
+       public $forceCaptcha = false;
+       
        /**
         * @inheritDoc
         */
@@ -49,7 +55,7 @@ abstract class AbstractCaptchaForm extends AbstractForm {
         * @inheritDoc
         */
        public function readData() {
-               if (!WCF::getUser()->userID && $this->useCaptcha && $this->captchaObjectTypeName) {
+               if ((!WCF::getUser()->userID || $this->forceCaptcha) && $this->useCaptcha && $this->captchaObjectTypeName) {
                        $this->captchaObjectType = CaptchaHandler::getInstance()->getObjectTypeByName($this->captchaObjectTypeName);
                        if ($this->captchaObjectType === null) {
                                throw new SystemException("Unknown captcha object type with name '".$this->captchaObjectTypeName."'");