Remove email activation process after registration via third-party
authorMarcel Werk <burntime@woltlab.com>
Wed, 24 Jul 2024 14:41:48 +0000 (16:41 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 24 Jul 2024 14:41:48 +0000 (16:41 +0200)
ref https://www.woltlab.com/community/thread/307268-benutzeraktivierung-bei-google-nutzung/

wcfsetup/install/files/lib/form/RegisterForm.class.php

index a04020db59ef71f22aadb68631a89b6fcedcbf2b..5d22eccd31220fa029d2b4fc8ab0635b25e59e34 100644 (file)
@@ -410,9 +410,11 @@ class RegisterForm extends UserAddForm
             || (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN)
         ) {
             $activationCode = UserRegistrationUtil::getActivationCode();
-            $emailConfirmCode = Hex::encode(\random_bytes(20));
             $this->additionalFields['activationCode'] = $activationCode;
-            $this->additionalFields['emailConfirmed'] = $emailConfirmCode;
+            if (!$registerVia3rdParty) {
+                $emailConfirmCode = Hex::encode(\random_bytes(20));
+                $this->additionalFields['emailConfirmed'] = $emailConfirmCode;
+            }
             $addDefaultGroups = false;
             $this->groupIDs = UserGroup::getGroupIDsByType([UserGroup::EVERYONE, UserGroup::GUESTS]);
         }
@@ -447,7 +449,11 @@ class RegisterForm extends UserAddForm
         } elseif (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_USER && empty($this->blacklistMatches)) {
             // registering via 3rdParty leads to instant activation
             if ($registerVia3rdParty) {
-                $this->message = 'wcf.user.register.success';
+                if (REGISTER_ACTIVATION_METHOD & User::REGISTER_ACTIVATION_ADMIN) {
+                    $this->message = 'wcf.user.register.success.awaitActivation';
+                } else {
+                    $this->message = 'wcf.user.register.success';
+                }
             } else {
                 $email = new Email();
                 $email->addRecipient(new UserMailbox(WCF::getUser()));