示例#1
0
 /**
  * Validates this model and creates a new account for the user.
  *
  * @return boolean whether sign-up was successful.
  */
 public function signup()
 {
     if ($this->validate()) {
         $dataContract = Module::getInstance()->getDataContract();
         $account = $dataContract->createAccount(['attributes' => $this->attributes]);
         if ($account->validate()) {
             if ($account->save(false)) {
                 $dataContract->createPasswordHistory(['accountId' => $account->id, 'password' => $account->password]);
                 $auth = Yii::$app->authManager;
                 $authorRole = $auth->getRole('salon');
                 $auth->assign($authorRole, $account->getId());
                 return true;
             }
         }
         foreach ($account->getErrors('password') as $error) {
             $this->addError('password', $error);
         }
         if ($errors = $account->getErrors()) {
             Yii::$app->session->setFlash('registration-errors', $errors);
         }
     }
     return false;
 }
示例#2
0
 /**
  * Creates a password history entry.
  *
  * @param Account $account model instance.
  */
 public function createHistoryEntry(ActiveRecord $account)
 {
     Module::getInstance()->getDataContract()->createPasswordHistory(['accountId' => $account->getPrimaryKey(), 'password' => $account->password]);
 }
示例#3
0
 public function actionIndex()
 {
     $model = Module::getInstance();
     return $this->render('index', ['model' => $model]);
 }
示例#4
0
 /**
  * Returns the account associated with the value of the login attribute.
  *
  * @return Account model instance.
  */
 public function getAccount()
 {
     if ($this->_account === null) {
         $this->_account = Account::findOne([Module::getInstance()->phoneAttribute => $this->phone]);
     }
     return $this->_account;
 }
示例#5
0
                <?php 
echo $form->field($model, 'email');
?>

                <?php 
echo $form->field($model, 'url');
?>

                <?php 
echo $form->field($model, 'password')->passwordInput();
?>
                <?php 
echo $form->field($model, 'verifyPassword')->passwordInput();
?>
                <?php 
if (Module::getInstance()->enableCaptcha) {
    ?>
                    <?php 
    echo $form->field($model, 'captcha')->widget($captchaClass, ['captchaAction' => Module::URL_ROUTE_CAPTCHA, 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-9">{input}</div></div>', 'imageOptions' => ['height' => 35]]);
    ?>

                    <p class="help-block">
                        <?php 
    echo Module::t('views', 'Пожалуйста введите проверочный код');
    ?>
                    </p>
                <?php 
}
?>

                <div class="form-group ">