Enable user if he confirms a new email
authorjoshuaruesweg <ruesweg@woltlab.com>
Thu, 18 Jun 2020 08:43:29 +0000 (10:43 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Thu, 18 Jun 2020 08:43:29 +0000 (10:43 +0200)
wcfsetup/install/files/lib/form/EmailActivationForm.class.php

index ee902b68f761ac3cb57fcbcd3505946176be5afb..17b31bbd6b89f1a860a18031bf343ba4e87bfdc0 100644 (file)
@@ -97,19 +97,20 @@ class EmailActivationForm extends AbstractForm {
                        'newEmail' => '',
                        'reactivationCode' => 0
                ];
-               if (!$this->user->isEmailConfirmed() && (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_USER)) {
-                       $data['emailConfirmed'] = null;
-                       
-                       if (!(REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN)) {
-                               $data['activationCode'] = 0;
-                       }
-               }
                
                // enable new email
                $this->objectAction = new UserAction([$this->user], 'update', [
                        'data' => array_merge($this->additionalFields, $data)
                ]);
                $this->objectAction->executeAction();
+               
+               // confirm email
+               if (!$this->user->isEmailConfirmed() && empty($this->user->blacklistMatches)) {
+                       // enable new email
+                       $this->objectAction = new UserAction([$this->user], 'confirmEmail');
+                       $this->objectAction->executeAction();
+               }
+               
                $this->saved();
                
                // forward to index page