From a6d1fa39668da1fbc4dacd46362eca9526640a49 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Wed, 3 Jun 2020 17:01:49 +0200 Subject: [PATCH] Improve condition readability MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Co-authored-by: Tim Düsterhus --- wcfsetup/install/files/lib/form/EmailActivationForm.class.php | 2 +- .../install/files/lib/form/RegisterActivationForm.class.php | 2 +- wcfsetup/install/files/lib/form/RegisterForm.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/form/EmailActivationForm.class.php b/wcfsetup/install/files/lib/form/EmailActivationForm.class.php index 4b7c079439..b05d1e8691 100644 --- a/wcfsetup/install/files/lib/form/EmailActivationForm.class.php +++ b/wcfsetup/install/files/lib/form/EmailActivationForm.class.php @@ -130,7 +130,7 @@ class EmailActivationForm extends AbstractForm { * @inheritDoc */ public function show() { - if (!(REGISTER_ACTIVATION_METHOD & 1)) { + if (!(REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_USER)) { throw new IllegalLinkException(); } diff --git a/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php b/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php index be803ec619..1e301270c6 100644 --- a/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php +++ b/wcfsetup/install/files/lib/form/RegisterActivationForm.class.php @@ -104,7 +104,7 @@ class RegisterActivationForm extends AbstractForm { $this->saved(); // forward to index page - if (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN && !$this->user->isActivated()) { + if ((REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN) && !$this->user->isActivated()) { $redirectText = WCF::getLanguage()->getDynamicVariable('wcf.user.registerActivation.success.awaitAdminActivation'); } else { diff --git a/wcfsetup/install/files/lib/form/RegisterForm.class.php b/wcfsetup/install/files/lib/form/RegisterForm.class.php index ded41b4346..62782b5ecf 100644 --- a/wcfsetup/install/files/lib/form/RegisterForm.class.php +++ b/wcfsetup/install/files/lib/form/RegisterForm.class.php @@ -429,7 +429,7 @@ class RegisterForm extends UserAddForm { // generate activation code $addDefaultGroups = true; - if (!empty($this->blacklistMatches) || (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_USER && !$registerVia3rdParty) || REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN) { + if (!empty($this->blacklistMatches) || (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_USER && !$registerVia3rdParty) || (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN)) { $activationCode = UserRegistrationUtil::getActivationCode(); $emailConfirmCode = bin2hex(\random_bytes(20)); $this->additionalFields['activationCode'] = $activationCode; -- 2.20.1