/** * @see Form::save() */ public function save() { parent::save(); // delete captcha if ($this->useCaptcha) { $this->captcha->delete(); } WCF::getSession()->unregister('captchaDone'); }
/** * @see Form::save() */ public function save() { AbstractForm::save(); // save language id $this->additionalFields['languageID'] = $this->languageID; // save registration ip address $this->additionalFields['registrationIpAddress'] = WCF::getSession()->ipAddress; // generate activation code $addDefaultGroups = true; if (REGISTER_ACTIVATION_METHOD == 1 || REGISTER_ACTIVATION_METHOD == 2) { $activationCode = UserRegistrationUtil::getActivationCode(); $this->additionalFields['activationCode'] = $activationCode; $addDefaultGroups = false; $this->groupIDs = Group::getGroupIdsByType(array(Group::EVERYONE, Group::GUESTS)); } // create $this->user = UserEditor::create($this->username, $this->email, $this->password, $this->groupIDs, $this->activeOptions, $this->additionalFields, $this->visibleLanguages, $addDefaultGroups); // update session WCF::getSession()->changeUser($this->user); // activation management if (REGISTER_ACTIVATION_METHOD == 0) { $this->message = 'wcf.user.register.success'; } if (REGISTER_ACTIVATION_METHOD == 1) { $mail = new Mail(array($this->username => $this->email), WCF::getLanguage()->get('wcf.user.register.needActivation.mail.subject', array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE))), WCF::getLanguage()->get('wcf.user.register.needActivation.mail', array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE), '$username' => $this->username, '$userID' => $this->user->userID, '$activationCode' => $activationCode, 'PAGE_URL' => PAGE_URL, 'MAIL_ADMIN_ADDRESS' => MAIL_ADMIN_ADDRESS))); $mail->send(); $this->message = 'wcf.user.register.needActivation'; } if (REGISTER_ACTIVATION_METHOD == 2) { $this->message = 'wcf.user.register.awaitActivation'; } // notify admin if (REGISTER_ADMIN_NOTIFICATION) { // get default language $language = WCF::getLanguage()->getLanguageID() != Language::getDefaultLanguageID() ? new Language(Language::getDefaultLanguageID()) : WCF::getLanguage(); $language->setLocale(); // send mail $mail = new Mail(MAIL_ADMIN_ADDRESS, $language->get('wcf.user.register.notification.mail.subject', array('PAGE_TITLE' => $language->get(PAGE_TITLE))), $language->get('wcf.user.register.notification.mail', array('PAGE_TITLE' => $language->get(PAGE_TITLE), '$username' => $this->username))); $mail->send(); WCF::getLanguage()->setLocale(); } // delete captcha if (REGISTER_USE_CAPTCHA && !WCF::getSession()->getVar('captchaDone')) { $this->captcha->delete(); } WCF::getSession()->unregister('captchaDone'); // login user UserAuth::getInstance()->storeAccessData($this->user, $this->username, $this->password); $this->saved(); // forward to index page WCF::getTPL()->assign(array('url' => 'index.php' . SID_ARG_1ST, 'message' => WCF::getLanguage()->get($this->message, array('$username' => $this->username, '$email' => $this->email)))); WCF::getTPL()->display('redirect'); exit; }