Exemplo n.º 1
0
 /**
  * @param string $hash
  * @return array|bool
  * @throws \yii\web\ServerErrorHttpException
  */
 public function sendNewPasswordRequestEmail($hash)
 {
     $Account = $this->Model;
     $url = UrlManager()->createAbsoluteUrl(['/account/forgot-password/check', 'email' => $Account->email, 'hash' => $hash]);
     $short_url = UrlManager()->createAbsoluteUrl(['/account/forgot-password/check', 'email' => $Account->email]);
     $Message = $this->createMessage('account.frontend.forgot-password.request', ['{user_id}' => $Account->id, '{username}' => $Account->name, '{hash}' => $hash, '{url}' => $url, '{short_url}' => $short_url]);
     $Message->addTo($Account->email, $Account->name);
     return $Message->sendImmediately();
 }
Exemplo n.º 2
0
 /**
  * @return array
  */
 public function actionIn()
 {
     $result = ['result' => false, 'message' => ['title' => \Yii::t('account', 'Sign In'), 'text' => \Yii::t('account', 'Unknown error.')]];
     $SignInForm = \Yii::createObject(Account\crm\forms\SignInForm::className());
     if ($SignInForm->load(Request()->post()) && $SignInForm->validate() && $SignInForm->login()) {
         $result = ['result' => true, 'message' => ['title' => \Yii::t('account', 'Sign In'), 'text' => \Yii::t('account', 'Welcome!')], 'redirect' => UrlManager()->createUrl(['/'])];
     }
     if ($SignInForm->hasErrors()) {
         $result = ['result' => false, 'message' => ['title' => \Yii::t('account', 'Sign In'), 'text' => \Yii::t('account', 'Form errors.')], 'errors' => $SignInForm->getFirstErrors()];
     }
     return $result;
 }
 public function testMain()
 {
     ob_start();
     dump(['test' => rand()]);
     // это тест!
     expect('Функция дампа не отдает результат', ob_get_clean())->notEmpty();
     $this->assertInstanceOf(yii\log\Dispatcher::class, YiiLog());
     $this->assertInstanceOf(yii\db\Connection::class, DB());
     $this->assertInstanceOf(yii\base\ErrorHandler::class, ErrorHandler());
     $this->assertInstanceOf(yii\caching\Cache::class, Cache());
     $this->assertInstanceOf(yii\i18n\Formatter::class, Formatter());
     $this->assertInstanceOf(yii\base\View::class, View());
     $this->assertInstanceOf(yii\i18n\I18N::class, I18N());
     $this->assertInstanceOf(yii\rbac\ManagerInterface::class, AuthManager());
     $this->assertInstanceOf(yii\web\AssetManager::class, AssetManager());
     $this->assertInstanceOf(yii\web\User::class, User());
     $this->assertInstanceOf(yii\base\Request::class, Request());
     $this->assertInstanceOf(yii\base\Response::class, Response());
     $this->assertInstanceOf(yii\web\Session::class, Session());
     $this->assertInstanceOf(yii\web\UrlManager::class, UrlManager());
     $this->assertInstanceOf(yii\mail\MailerInterface::class, Mailer());
     $this->assertInstanceOf(services\File\Service::class, FileService());
     $this->assertInstanceOf(services\Activity\Service::class, ActivityService());
 }
Exemplo n.º 4
0
 /**
  * @return array
  * @throws \yii\web\BadRequestHttpException
  */
 public function actionFill()
 {
     $result = ['result' => false, 'message' => ['title' => \Yii::t('account', 'Fill attributes'), 'text' => \Yii::t('account', 'Unknown error.')]];
     $Client = Session()->get('OAuthResponseClient');
     if (empty($Client)) {
         throw new \yii\web\BadRequestHttpException();
     }
     /** @var Account\frontend\forms\FillAttributesForm $FillAttributesForm */
     $FillAttributesForm = \Yii::createObject(Account\frontend\forms\FillAttributesForm::className());
     if ($FillAttributesForm->load(Request()->post()) && $FillAttributesForm->validate() && $FillAttributesForm->save($Client)) {
         $result = ['result' => true, 'message' => ['title' => \Yii::t('account', 'Fill attributes'), 'text' => \Yii::t('account', 'Welcome!')], 'redirect' => UrlManager()->createUrl(['/'])];
     }
     if ($FillAttributesForm->hasErrors()) {
         $result = ['result' => false, 'message' => ['title' => \Yii::t('account', 'Fill attributes'), 'text' => \Yii::t('account', 'Form errors.')], 'errors' => $FillAttributesForm->getFirstErrors()];
     }
     return $result;
 }
Exemplo n.º 5
0
?>
</h3>
        </div>

        <div class="box-body">
            <div class="form-group" ng-if="getClientId()">
                <label class="control-label" for="clienteditform-email">Account</label>

                <span ng-if="!data.account">
                    Not created. <?php 
echo Html::tag('a', 'Create', ['data-action' => UrlManager()->createUrl(['/client/rest/client/create-account']), 'ng-click' => 'account.create($event)']);
?>
                </span>
                <span ng-if="data.account">
                    #{{ data.account.id }} {{ data.account.name }} <?php 
echo Html::tag('a', 'unlink', ['data-action' => UrlManager()->createUrl(['/client/rest/client/unlink-account']), 'ng-click' => 'account.unlink($event)']);
?>
                </span>
            </div>

            <?php 
echo $form->field($ClientEditForm, 'name')->textInput();
echo $form->field($ClientEditForm, 'email')->textInput();
echo $form->field($ClientEditForm, 'phone')->textInput();
?>
        </div>

        <div class="box-footer">
            <?php 
echo Html::submitButton(FA::icon('check') . ' ' . Yii::t('cookyii', 'Save'), ['class' => 'btn btn-success', 'ng-disabled' => 'in_progress']);
echo Html::button(Yii::t('cookyii', 'Cancel'), ['class' => 'btn btn-link', 'ng-click' => 'reload()']);