此方法用于注册新用户帐户。 如果 enableConfirmation 设置为true，则此方法
将生成新的确认令牌，并使用邮件发送给用户。

@return boolean
19734
public function register()
    {
        if ($this->getIsNewRecord() == false) {
            throw new \RuntimeException('Calling "' . __CLASS__ . '::' . __METHOD__ . '" on existing user');
        }
        $this->password = Yii::$app->settings->get('user.enableGeneratingPassword') ? PasswordHelper::generate(8) : $this->password;
        if ($this->scenario == self::SCENARIO_EMAIL_REGISTER) {
            $this->email_confirmed_at = Yii::$app->settings->get('user.enableConfirmation') ? null : time();
        }
        $this->trigger(self::BEFORE_REGISTER);
        if (!$this->save()) {
            return false;
        }
        if (Yii::$app->settings->get('user.enableConfirmation') && !empty($this->email)) {
            /** @var UserToken $token */
            $token = new UserToken(['type' => UserToken::TYPE_CONFIRMATION]);
            $token->link('user', $this);
            Yii::$app->sendMail($this->email, Yii::t('yuncms', 'Welcome to {0}', Yii::$app->name), 'user/welcome', ['user' => $this, 'token' => isset($token) ? $token : null, 'module' => Yii::$app->getModule('user'), 'showPassword' => false]);
        } else {
            Yii::$app->user->login($this, Yii::$app->settings->get('user.rememberFor'));
        }
        $this->trigger(self::AFTER_REGISTER);
        return true;
    }
1343182
public function isConfirmAGBActive()
    {
        if ($this->_blConfirmAGB === null) {
            $this->_blConfirmAGB = false;
            $this->_blConfirmAGB = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('blConfirmAGB');
        }

        return $this->_blConfirmAGB;
    }
1362958
public function enable()
    {
        $updatedCheck = $this->ohDear->enableCheck($this->id);

        $this->enabled = $updatedCheck->enabled;
    }
1273451
public function isAllowedToNotify()
    {
        $allowed = false;
        if (null !== $this->dropzone && $this->dropzone->getNotifyOnDrop()) {
            $allowed = true;
        }

        return $allowed;
    }
498706
public static function enable()
    {
        Builder::macro(self::MACRO_METHOD, function (Fluent $builder, callable $callback = null) {
            $tree = new static($builder);

            if (is_callable($callback)) {
                call_user_func($callback, $tree);
            }

            return $tree;
        });

        NestedSet::enable();
        MaterializedPath::enable();
        ClosureTable::enable();
    }
872966
public function checkIfReady()
    {
        if (!$this->attrs->paramsDone || !$this->attrs->inputDone) {
            return false;
        }
        if (isset($this->appInstance->passphrase)) {
            if (!isset($this->attrs->server['PASSPHRASE'])
                || ($this->appInstance->passphrase !== $this->attrs->server['PASSPHRASE'])
            ) {
                $this->finish();
            }

            return false;
        }

        if ($this->attrs->input->isFrozen()) {
            return false;
        }

        if ($this->sleepTime === 0) {
            $this->wakeup();
        }

        return true;
    }
911259
public function sure()
    {
        if ($this->hasOption('start')) {
            $this->addOption('doNotSelfQlose');
        }
        if (empty($this->args[0])) {
            $this->args[0] = array();
        }
        switch ($this->called) {
        case 'jquery':
            $this->called = 'script';
            $this->args[0] = array_merge(
                array(
                    'type' => 'text/javascript',
                    'src' => 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'
                ),
                $this->args[0]
            );

            return false;
        case 'jqueryui':
            $this->called = 'script';
            $this->args[0] = array_merge(
                array(
                    'type' => 'text/javascript',
                    'src' => 'https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js'
                ),
                $this->args[0]
            );

            return false;
        default:
            $this->called = 'script';
            break;
        }

        if (empty($this->args[0])) {
            return false;
        }

        return is_array($this->args[0])
         || !(substr($this->args[0], 0, 4) == 'http'
         || substr($this->args[0], 0, 3) == '../'
         || substr($this->args[0], 0, 3) == '\./'
         || substr($this->args[0], 0, 2) == './'
         || substr($this->args[0], 0, 1) == '/'
        );
    }
1278571
public function getIsConfirmed()
    {
        $cAttribute = $this->confirmationAttribute;
        return (is_string($cAttribute) && !empty($cAttribute)) ? $this->$cAttribute > static::$confirmFalse : true;
    }
1094994
protected function validateWishlist()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->wishlist->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Wishlist'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
759941
public function hasPendingChangesets()
    {
        $qb = $this->createQueryBuilder('ac')
            ->select('count(ac)')
            ->where('ac.status = :status')
            ->setParameter('status', AclChangeset::STATUS_NEW);

        return $qb->getQuery()->getSingleScalarResult() != 0;
    }
691203
public function can_create() {
        return in_array($this->mode, array(tool_uploadcourse_processor::MODE_CREATE_ALL,
            tool_uploadcourse_processor::MODE_CREATE_NEW,
            tool_uploadcourse_processor::MODE_CREATE_OR_UPDATE)
        );
    }
751627
public function verifyReturn(){
        if(empty($_GET)) {//判断POST来的数组是否为空
            return false;
        }
        else {
            //生成签名结果
            $isSign = $this->getSignVeryfy($_GET, $_GET["sign"]);
            //获取支付宝远程服务器ATN结果（验证是否是支付宝发来的消息）
            $responseTxt = 'true';
            if (! empty($_GET["notify_id"])) {$responseTxt = $this->getResponse($_GET["notify_id"]);}

            //写日志记录
            //if ($isSign) {
            //	$isSignStr = 'true';
            //}
            //else {
            //	$isSignStr = 'false';
            //}
            //$log_text = "responseTxt=".$responseTxt."\n return_url_log:isSign=".$isSignStr.",";
            //$log_text = $log_text.createLinkString($_GET);
            //logResult($log_text);

            //验证
            //$responsetTxt的结果不是true，与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
            //isSign的结果不是true，与安全校验码、请求时的参数格式（如：带自定义参数等）、编码格式有关
            if (preg_match("/true$/i",$responseTxt) && $isSign) {
                return true;
            } else {
                return false;
            }
        }
    }
163784
public function forupdate() {
        try {
            $this->checkDialect();
        } catch (DialectException $e) {
            return false;
        }
        // 不在事务中锁定失败.
        if (!$this->dialect->inTransaction()) {
            return false;
        }
        $this->forupdate = true;
        $data            = $this->get();
        // 成功
        if ($data) {
            return $data;
        }

        return false;
    }
1161627
public function submitCode()
    {
        if (!$this->model->validate()) {
            throw new PhoneConfirmationException('Form validation failed');
        }

        try {
            Contact::perform('confirm-phone', [
                'id' => $this->model->id,
                'type' => $this->model->type,
                'phone' => $this->model->phone,
                'code' => $this->model->code,
            ]);
        } catch (ResponseErrorException $e) {
            if ($e->getMessage() === 'wrong code') {
                throw new PhoneConfirmationException(Yii::t('hipanel:client', 'Wrong confirmation code'));
            }

            throw new PhoneConfirmationException($e->getMessage());
        }

        return true;
    }
842178
public function create () : bool
	{
        $dbObject 	= Database::getInstance();
		$attributes = $this->sanitizedAttributes();
		$sqlQuery	= "INSERT INTO ".static::$tableName." (";
		$sqlQuery  .= join(", ", array_keys($attributes));
	  	$sqlQuery  .= ") VALUES ('";
		$sqlQuery  .= join("', '", array_values($attributes));
		$sqlQuery  .= "')";
		$result 	= $dbObject->query($sqlQuery);
    	$this->id 	= $dbObject->insertId();
    	return ($result) ? TRUE : FALSE;
	}
1000365
public function create()
    {
        // Validate form
        $form = $this->getForm('Create' . $this->getEntityName());
        if (!$form->isValid()) {
            return false;
        }

        // Insert new entity
        $now    = new \DateTime();
        $entity = $form->getData();
        $entity->setLastModified($now);
        $entity->setCreated($now);

        // Trigger oncreate
        $this->onCreate($entity);

        // Save
        $this->getEntityManager()->persist($entity);
        return $this->save($this->getEntityName() . ' created.', 'Unable to create ' . strtolower($this->getEntityName()) . '.');
    }
475948
public function confirmEmailChangePasswordAction()
    {
      $token = $this->params()->fromRoute('id');
      try {
        $entityManager = $this->getEntityManager();
        if($token !== '' && $user = $entityManager->getRepository('CsnUser\Entity\User')->findOneBy(array('registrationToken' => $token))) {
          $user->setRegistrationToken(md5(uniqid(mt_rand(), true)));
          $password = $this->generatePassword();
          $user->setPassword(UserCredentialsService::encryptPassword($password));
          $email = $user->getEmail();
          $fullLink = $this->getBaseUrl() . $this->url()->fromRoute('user-index', array( 'action' => 'login'));
          $this->sendEmail(
              $user->getEmail(),
              'Your password has been changed!',
              sprintf($this->getTranslatorHelper()->translate('Hello again %s. Your new password is: %s. Please, follow this link %s to log in with your new password.'), $user->getUsername(), $password, $fullLink)
              
          );          
          $entityManager->persist($user);
          $entityManager->flush();
    
          $viewModel = new ViewModel(array(
              'email' => $email,
              'navMenu' => $this->getOptions()->getNavMenu()
          ));
          return $viewModel;
        } else {
          return $this->redirect()->toRoute('user-index');
        }
      } catch (\Exception $e) {
        return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView(
            $this->getTranslatorHelper()->translate('An error occured during the confirmation of your password change! Please, try again later.'),
            $e,
            $this->getOptions()->getDisplayExceptions(),
            $this->getOptions()->getNavMenu()
        );
      }
    }