From 27b0cb06995e1d442db282cf5827caf012827531 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 2 Dec 2015 15:18:40 +0200 Subject: [PATCH] VItaliy 02.12.2015 --- backend/config/main.php | 9 +++++++++ backend/controllers/NewsController.php | 2 +- backend/views/layouts/main.php | 1 + common/models/Accounts.php | 95 ++++++++++++++++++++++++++++++++++++++++------------------------------------------------------- common/models/AccountsForm.php | 139 ------------------------------------------------------------------------------------------------------------------------------------------- common/models/User.php | 2 ++ common/models/UserLoginForm.php | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ console/migrations/m151201_151524_add_field_auth_key_for_accounts.php | 34 ++++++++++++++++++++++++++++++++++ frontend/config/main.php | 13 +++++++++++-- frontend/controllers/AccountsController.php | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/SiteController.php | 33 ++++++++++++++++++++------------- frontend/views/accounts/cabinet.php | 387 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/layouts/main.php | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- frontend/views/site/cabinet.php | 390 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ frontend/views/site/login.php | 24 ++++++++++++++++++++++++ frontend/views/site/provider.php | 65 ----------------------------------------------------------------- frontend/views/site/registration_form.php | 166 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- frontend/views/site/signup.php | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/site/wholesalers.php | 52 ---------------------------------------------------- frontend/web/css/main.css | 2 +- frontend/web/css/style/my_profile.css | 15 --------------- frontend/web/js/main.js | 16 ++++++++-------- test.html | 2 ++ 23 files changed, 824 insertions(+), 954 deletions(-) delete mode 100644 common/models/AccountsForm.php create mode 100755 common/models/UserLoginForm.php create mode 100644 console/migrations/m151201_151524_add_field_auth_key_for_accounts.php create mode 100644 frontend/controllers/AccountsController.php create mode 100755 frontend/views/accounts/cabinet.php delete mode 100755 frontend/views/site/cabinet.php create mode 100644 frontend/views/site/login.php delete mode 100755 frontend/views/site/provider.php delete mode 100755 frontend/views/site/registration_form.php create mode 100755 frontend/views/site/signup.php delete mode 100755 frontend/views/site/wholesalers.php create mode 100644 test.html diff --git a/backend/config/main.php b/backend/config/main.php index 2c2adc9..a9fa841 100755 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -16,6 +16,9 @@ return [ 'user' => [ 'identityClass' => 'common\models\User', 'enableAutoLogin' => true, + 'identityCookie' => [ + 'name' => '_backendUser', // unique for backend + ] ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, @@ -30,6 +33,8 @@ return [ 'errorAction' => 'parser/error', ], 'request'=>[ + 'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i', + 'csrfParam' => '_backendCSRF', 'class' => 'common\components\Request', @@ -38,6 +43,10 @@ return [ 'adminUrl' => '/admin' ], + 'session' => [ + 'name' => 'PHPBACKSESSID', + 'savePath' => __DIR__ . '/../tmp', + ], ], 'params' => $params, diff --git a/backend/controllers/NewsController.php b/backend/controllers/NewsController.php index 7a28fcd..b402293 100755 --- a/backend/controllers/NewsController.php +++ b/backend/controllers/NewsController.php @@ -95,7 +95,7 @@ class NewsController extends BaseController - if ($model->load(Yii::$app->request->post()) /*&& $model->save()*/ ) { + if ($model->load(Yii::$app->request->post()) && $model->save() ) { if ($model['mail_send'] == '1') { $sEmails = array(); diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php index a5d22e8..38dec0d 100755 --- a/backend/views/layouts/main.php +++ b/backend/views/layouts/main.php @@ -8,6 +8,7 @@ use yii\helpers\Html; MyAsset::register($this); ?> + beginPage() ?> diff --git a/common/models/Accounts.php b/common/models/Accounts.php index 773e593..9f3cc08 100755 --- a/common/models/Accounts.php +++ b/common/models/Accounts.php @@ -13,6 +13,7 @@ use yii\db\ActiveRecord; * @property integer $id * @property integer $if_manager * @property string $email + * @property string $auth_key * @property string $pass * @property integer $margin_id * @property string $name @@ -53,6 +54,11 @@ class Accounts extends ActiveRecord implements IdentityInterface public $re_pass; public $surname; public $country_region; + public $verifyCode; + public $auth_key; + public $password_hash; + public $password_reset_token; + /** * @inheritdoc @@ -66,6 +72,7 @@ class Accounts extends ActiveRecord implements IdentityInterface public function beforeSave() { $this->dt = time(); + $this->name = $this->surname.' '.$this->name; return true; } @@ -89,7 +96,11 @@ class Accounts extends ActiveRecord implements IdentityInterface [['email'], 'unique'], [['email'], 'email'], ['re_pass', 'compare', 'compareAttribute' => 'pass'], - ['dt', 'date', 'format' => 'Y.m.d'] + ['verifyCode', 'captcha'], + ['dt', 'date', 'format' => 'Y.m.d'], + [['rating','if_manager','set_manager_id','balance'], 'default', 'value' => '0'], + [['is_active','margin_id','office_id','is_scribe'], 'default', 'value' => '1'], + [['comment'], 'default', 'value' => 'Новый пользователь'], ]; } @@ -149,56 +160,7 @@ class Accounts extends ActiveRecord implements IdentityInterface { if ($this->validate()) { - $this->name = $this->surname.' '.$this->name; - - if( $this->is_firm ){ - $this->if_manager = '0'; - $this->margin_id = '1'; - $this->address = ''; - $this->comment = 'Новый пользователь'; - $this->rating = '0'; - $this->is_active = '1'; - $this->last_loginin = ''; - $this->firm_inn = ''; - $this->firm_bank =''; - $this->balance ='0.00'; - $this->office_id ='1'; - $this->is_scribe ='1'; - $this->set_manager_id ='0'; - $this->phones2=''; - $this->phones3 =''; - $this->snumb =''; - $this->firm_ur_adr =''; - $this->firm_fiz_adr = ''; - $this->firm_code_eg = ''; - $this->firm_rs = ''; - $this->firm_mfo = ''; - $this->firm_site = ''; - }else{ - - $this->if_manager = '0'; - $this->margin_id = '1'; - $this->address = ''; - $this->comment = 'Новый пользователь'; - $this->rating = '0'; - $this->is_active = '1'; - $this->last_loginin = ''; - $this->firm_inn = ''; - $this->firm_bank =''; - $this->balance ='0.00'; - $this->office_id ='1'; - $this->is_scribe ='1'; - $this->set_manager_id ='0'; - $this->phones2=''; - $this->phones3 =''; - $this->snumb =''; - $this->firm_ur_adr =''; - $this->firm_fiz_adr = ''; - $this->firm_code_eg = ''; - $this->firm_rs = ''; - $this->firm_mfo = ''; - $this->firm_site = ''; - } + if ($this->save()) { return $this; @@ -224,14 +186,14 @@ class Accounts extends ActiveRecord implements IdentityInterface } /** - * Finds user by username + * Finds user by email * - * @param string $username + * @param string $email * @return static|null */ - public static function findByUsername($username) + public static function findByEmail($email) { - return static::findOne(['name' => $username]); + return static::findOne(['email' => $email]); } /** @@ -283,4 +245,27 @@ class Accounts extends ActiveRecord implements IdentityInterface { $this->password_reset_token = null; } + + /** + * Finds out if password reset token is valid + * + * @param string $token password reset token + * @return boolean + */ + public static function isPasswordResetTokenValid($token) + { + if (empty($token)) { + return false; + } + $expire = Yii::$app->params['user.passwordResetTokenExpire']; + $parts = explode('_', $token); + $timestamp = (int) end($parts); + return $timestamp + $expire >= time(); + } + + + + + + } diff --git a/common/models/AccountsForm.php b/common/models/AccountsForm.php deleted file mode 100644 index 5627874..0000000 --- a/common/models/AccountsForm.php +++ /dev/null @@ -1,139 +0,0 @@ - 150], - [['pass','re_pass'], 'string', 'max' => 30], - [['phones', 'phones2', 'phones3'], 'string', 'max' => 50], - [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254], - [['last_loginin'], 'string', 'max' => 15], - [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255], - [['email'], 'unique'], - [['email'], 'email'], - ['re_pass', 'compare', 'compareAttribute' => 'pass'], - ['verifyCode', 'captcha'], - ['dt', 'date', 'format' => 'Y.m.d'] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'if_manager' => 'Статус менеджера', - 'email' => 'E-mail (Логин)', - 'pass' => 'Пароль', - 'margin_id' => 'Тип цены', - 'name' => 'Имя', - 'phones' => 'Телефоны', - 'country' => Yii::t('app', 'Country'), - 'city' =>'Город', - 'address' => 'Адрес', - 'comment' => 'Комментарий', - 'rating' => Yii::t('app', 'Rating'), - 'dt' =>'Дата регистрации', - 'is_active' => 'Активный', - 'is_firm' => 'Юридическое лицо', - 'last_loginin' => Yii::t('app', 'Last Loginin'), - 'firm_inn' => 'ИНН', - 'firm_bank' => 'Банк', - 'balance' => Yii::t('app', 'Balance'), - 'office_id' => Yii::t('app', 'Office ID'), - 'is_scribe' => 'Подписка', - 'set_manager_id' => 'Персональный менеджер', - 'phones2' => 'Телефоны 2', - 'phones3' => 'Телефоны 3', - 'car' => Yii::t('app', 'Car'), - 'mod' => Yii::t('app', 'Mod'), - 'snumb' => 'snumb', - 'deliveries' => Yii::t('app', 'Deliveries'), - 'scode' => 'Код в 1С', - 'firm_ur_adr' => 'Юридический адрес', - 'firm_fiz_adr' => 'Физический адрес', - 'firm_code_eg' => 'Код ЭГ', - 'firm_rs' => 'Расчётный счёт', - 'firm_mfo' => 'МФО', - 'firm_site' => 'Сайт', - 'company' => 'Название фирмы', - 'country_region' => 'Регион' - ]; - } - - -} diff --git a/common/models/User.php b/common/models/User.php index a23707a..11a41b3 100755 --- a/common/models/User.php +++ b/common/models/User.php @@ -130,6 +130,7 @@ class User extends ActiveRecord implements IdentityInterface */ public function getAuthKey() { + return $this->auth_key; } @@ -138,6 +139,7 @@ class User extends ActiveRecord implements IdentityInterface */ public function validateAuthKey($authKey) { + return $this->getAuthKey() === $authKey; } diff --git a/common/models/UserLoginForm.php b/common/models/UserLoginForm.php new file mode 100755 index 0000000..fad1bd4 --- /dev/null +++ b/common/models/UserLoginForm.php @@ -0,0 +1,77 @@ +hasErrors()) { + $user = $this->getUser(); + if (!$user || !$user->validatePassword($this->password)) { + $this->addError($attribute, 'Incorrect email or password.'); + } + } + } + + /** + * Logs in a user using the provided email and password. + * + * @return boolean whether the user is logged in successfully + */ + public function login() + { + + if ($this->validate()) { + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); + } else { + return false; + } + } + + /** + * Finds user by [[email]] + * + * @return User|null + */ + protected function getUser() + { + if ($this->_user === null) { + $this->_user = Accounts::findByEmail($this->email); + } + + return $this->_user; + } +} diff --git a/console/migrations/m151201_151524_add_field_auth_key_for_accounts.php b/console/migrations/m151201_151524_add_field_auth_key_for_accounts.php new file mode 100644 index 0000000..9c49fc3 --- /dev/null +++ b/console/migrations/m151201_151524_add_field_auth_key_for_accounts.php @@ -0,0 +1,34 @@ +execute($view); + } + + public function down() + { + echo "m151201_151524_add_field_auth_key_for_accounts cannot be reverted.\n"; + + return false; + } + + /* + // Use safeUp/safeDown to run migration code within a transaction + public function safeUp() + { + } + + public function safeDown() + { + } + */ +} diff --git a/frontend/config/main.php b/frontend/config/main.php index aaef635..151622a 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -13,16 +13,25 @@ return [ 'controllerNamespace' => 'frontend\controllers', 'components' => [ 'user' => [ - 'identityClass' => 'common\models\User', + 'identityClass' => 'common\models\Accounts', 'enableAutoLogin' => true, + 'identityCookie' => [ + 'name' => '_frontendUser', // unique for frontend + ] ], 'request'=>[ - + 'cookieValidationKey' => 'ndahjhjjidasuidrqeswuiuirqw89', + 'csrfParam' => '_frontendCSRF', 'class' => 'common\components\Request', 'web'=> '/frontend/web' ], + 'session' => [ + 'name' => 'PHPFRONTSESSID', + 'savePath' => __DIR__ . '/../tmp', + + ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php new file mode 100644 index 0000000..5cac7f2 --- /dev/null +++ b/frontend/controllers/AccountsController.php @@ -0,0 +1,89 @@ + [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => ['cabinet',], + 'allow' => true, + 'roles' => ['@'], + ], + ], + ], + ]; + } + + + public function actionCabinet() + { + + return $this->render('cabinet',[ + 'model' => $this->findModel(Yii::$app->user->identity->id) + ]); + } + + public function actionIndex() + { + $dataProvider = new ActiveDataProvider([ + 'query' => News::find()->where(['is_active'=>1]), + 'pagination' => [ + 'pageSize' => 16, + ], + + ]); + return $this->render('index',[ + 'dataProvider' => $dataProvider + ]); + } + + public function actionView($translit) + { + + $activeNews = $this->findModel($translit); + $next_news = News::find()->where(['is_active'=>1])->andWhere('id > :id',[':id' => $activeNews->id])->one(); + $prev_news = News::find()->where(['is_active'=>1])->andWhere('id < :id',[':id' => $activeNews->id])->one(); + + return $this->render('view', [ + 'model' => $activeNews, + 'next_news' => $next_news instanceof News ? $next_news : '', + 'prev_news' => $prev_news instanceof News ? $prev_news : '' + ]); + } + + protected function findModel($id) + { + + if (($model = Accounts::findOne(["id"=>$id])) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + + + + + +} diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 13634a6..34f351c 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -2,13 +2,12 @@ namespace frontend\controllers; use common\models\Accounts; -use common\models\AccountsForm; use common\models\News; use common\models\Slider; use common\models\Team; use common\models\TeamGroup; use Yii; -use common\models\LoginForm; +use common\models\UserLoginForm; use frontend\models\PasswordResetRequestForm; use frontend\models\ResetPasswordForm; use frontend\models\SignupForm; @@ -51,6 +50,7 @@ class SiteController extends Controller */ public function actionIndex() { + $this->layout = '/outer'; $news_list = News::find()->where(['is_active'=>1])->limit(3)->all(); @@ -127,11 +127,6 @@ class SiteController extends Controller return $this->render('busket_step2'); } - public function actionCabinet() - { - $this->layout = '/internal'; - return $this->render('cabinet'); - } public function actionCatalogMarokStep2() { @@ -272,14 +267,19 @@ class SiteController extends Controller */ public function actionLogin() { + + if (!\Yii::$app->user->isGuest) { + return $this->goHome(); } - $model = new LoginForm(); + $model = new UserLoginForm(); + if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } else { + $this->layout = '/internal'; return $this->render('login', [ 'model' => $model, ]); @@ -334,16 +334,23 @@ class SiteController extends Controller */ public function actionSignup() { + + $this->layout = '/internal'; + $model = new Accounts(); - if ($model->load(Yii::$app->request->post(),'AccountsForm')) { + if ($model->load(Yii::$app->request->post()) ) { + + $model->generateAuthKey(); - if ($user = $model->signup()) { + $model->save(); + + if (Yii::$app->getUser()->login($model)) { + + return $this->goHome(); - if (Yii::$app->getUser()->login($user)) { - return $this->goHome(); - } } + } return $this->render('signup', [ diff --git a/frontend/views/accounts/cabinet.php b/frontend/views/accounts/cabinet.php new file mode 100755 index 0000000..a118780 --- /dev/null +++ b/frontend/views/accounts/cabinet.php @@ -0,0 +1,387 @@ +registerCssFile('/css/about_company.css'); +$this->registerCssFile('/css/style/notepad.css'); +$this->registerCssFile('/css/style/my_profile.css'); +$this->registerCssFile('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'); +$this->registerJsFile('//code.jquery.com/ui/1.11.4/jquery-ui.js'); + +$this->title = 'Мой профиль'; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+

Мой профиль

+
+ +
+
+

Личные данные

+
+ + + ['enctype'=> 'multipart/form-data','class'=>'my_profile'], 'method'=>'post','action' => '/site/signup',]); ?> + + field($model, 'is_firm')->hiddenInput(['value'=>'0']) ?> + + field($model, 'company')->hiddenInput(['value'=>'Частное лицо']) ?> + + field($model, 'name',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Имя']) ?> + + field($model, 'surname',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Фамилия']) ?> + + field($model, 'phones',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Телефон']) ?> + + field($model, 'email',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration']) ?> + + field($model, 'pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?> + + field($model, 're_pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?> + + field($model, 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList( + ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'), + ['prompt' => 'Выберите область'] + ); + ?> + + field($model, 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList( + [], + ['prompt' => 'Выберите город'] + ); + ?> + + field($model, 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList( + ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'), + ['prompt' => 'Выберите тип перевозки'] + ); + ?> + + + + + + + + +
+ + +
+
+ +
+

Корзина

+

грн

+

$

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ДетальЦенаКолл.Сумма
155565: EXIDE TECHNOLOGIES S.A.: Аккумулятор 55Ah-12v VOLTMASTER (242х175х190),L,EN4604.93
+ +
+ + +
+
4.93
2Аккумулятор 200Ah-12v Energizer Com. (518х276х242), L,EN1050 Energizer 700038105124.96
+ +
+ + +
+
124.96
3Антифриз 1л. Land Rover stc505292.85
+ +
+ + +
+
2.85
+
+Итого: 142.52$ +
+ +
+
+
+

История заказов

+
+ +
+ + +
+
+
+ + + + +
+

$

+

грн

+
+
+

Статус:

+
Все
+
+ Все + В работе + Готово +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ДатаДетальЦенаСуммаСтатус
10.09.2015OX370D: MAHLE FILTER: Фільтр масляний Mahle Volvo4.939.98В работе

Итого: 142.65$

03.07.2015OX370D: MAHLE FILTER: Фільтр масляний Mahle Volvo4.939.98Готово
OX370D: MAHLE FILTER: Фільтр масляний Mahle Volvo4.939.98

Итого: 142.65$

+
+
+
+ + + + +
+
+

Наши проекты

+ + 1/ + 5 + +
+ + + + + +
+ +
+ lr.italauto.com.ua +
+
    +

    Запчасти на Land Rover
    и Range Rover

    +
  • Оригинальные запчасти
  • +
  • Сертифицированый продавец
  • +
  • Более 300 000 товаров
  • +
+
+ + + + +
+ +
+ lr.italauto.com.ua +
+
    +

    Запчасти на
    Mercedes Benz

    +
  • Оригинальные запчасти
  • +
  • Сертифицированый продавец
  • +
  • Более 300 000 товаров
  • +
+
+ + + + +
+ +
+ lr.italauto.com.ua +
+
    +

    Запчасти на FIAT

    +
  • Оригинальные запчасти
  • +
  • Сертифицированый продавец
  • +
  • Более 300 000 товаров
  • +
+
+ + + + +
+ +
+ lr.italauto.com.ua +
+
    +

    Запчасти на Land Rover
    и Range Rover

    +
  • Оригинальные запчасти
  • +
  • Сертифицированый продавец
  • +
  • Более 300 000 товаров
  • +
+
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index a198cf3..11f7baf 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -5,22 +5,17 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -use yii\bootstrap\Nav; -use yii\bootstrap\NavBar; -use yii\widgets\Breadcrumbs; -use frontend\assets\AppAsset; -use common\widgets\Alert; use \yii\widgets\Menu; use \yii\helpers\Url; use common\models\Callback; use \common\models\Accounts; -use \common\models\AccountsForm; use \yii\helpers\ArrayHelper; use \common\models\DicCities; use \common\models\Deliveries; use yii\captcha\Captcha; - +use \common\models\UserLoginForm; ?> + beginPage() ?> @@ -101,13 +96,7 @@ use yii\captcha\Captcha;
- -

050 -0400-192

@@ -178,13 +167,21 @@ use yii\captcha\Captcha;
- - -
+ + user->isGuest):?>

Войти

Личный кабинет + + + +

user->identity->name?>

+ 'own_page']) ?> + + + +
@@ -352,25 +349,36 @@ use yii\captcha\Captcha;