From 17b9b1501b1d4de3108e0c091c2a063cf39f0106 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 24 May 2016 18:17:17 +0200 Subject: [PATCH] Added parameter to force captcha usage for registered users --- CHANGELOG.md | 1 + .../files/lib/form/AbstractCaptchaForm.class.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a5625b339..821f1df839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php b/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php index 4643d058fd..dc8355e7c8 100644 --- a/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php +++ b/wcfsetup/install/files/lib/form/AbstractCaptchaForm.class.php @@ -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."'"); -- 2.20.1