コード例 #1
0
 public function registerByAdmin()
 {
     $this->formAfterCheck();
     if (!$this->hasErrors()) {
         $user = new Users('create');
         $user->username = $this->username;
         $user->email = $this->email;
         $user->password = CPasswordHelper::hashPassword($this->password);
         $user->email_verified = intval($this->verified);
         if ($user->save()) {
             MailHelper::sendUserCredentials($this->username, $this->email, $this->password);
             if (!$this->verified) {
                 $url_maintenance = $user->getMaintenanceUrl();
                 $user->save();
                 MailHelper::sendRegisterConfirmMail($user->username, $user->email, $url_maintenance);
             }
             ListingNames::model()->getUserIgnoreList($user->id);
             return true;
         } else {
             $this->addErrors($user->getErrors());
         }
     }
     return false;
 }
コード例 #2
0
 public function actionResendConfirmation($user_id)
 {
     $user = Users::model()->getUserById($user_id);
     if (empty($user)) {
         throw new CHttpException(404, 'The requested page does not exist.');
     } elseif ($user->email_verified) {
         $this->setFlashInfo('User email already verified');
         $this->redirect(array('login'));
     }
     $url_maintenance = $user->getMaintenanceUrl();
     MailHelper::sendRegisterConfirmMail($user->username, $user->email, $url_maintenance);
     $this->setFlashSuccess('New confirm email was sent to your email');
     $this->redirect(array('login'));
 }