Commit 27b0cb06995e1d442db282cf5827caf012827531

Authored by Administrator
1 parent 25545a10

VItaliy 02.12.2015

backend/config/main.php
@@ -16,6 +16,9 @@ return [ @@ -16,6 +16,9 @@ return [
16 'user' => [ 16 'user' => [
17 'identityClass' => 'common\models\User', 17 'identityClass' => 'common\models\User',
18 'enableAutoLogin' => true, 18 'enableAutoLogin' => true,
  19 + 'identityCookie' => [
  20 + 'name' => '_backendUser', // unique for backend
  21 + ]
19 ], 22 ],
20 'log' => [ 23 'log' => [
21 'traceLevel' => YII_DEBUG ? 3 : 0, 24 'traceLevel' => YII_DEBUG ? 3 : 0,
@@ -30,6 +33,8 @@ return [ @@ -30,6 +33,8 @@ return [
30 'errorAction' => 'parser/error', 33 'errorAction' => 'parser/error',
31 ], 34 ],
32 'request'=>[ 35 'request'=>[
  36 + 'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i',
  37 + 'csrfParam' => '_backendCSRF',
33 38
34 'class' => 'common\components\Request', 39 'class' => 'common\components\Request',
35 40
@@ -38,6 +43,10 @@ return [ @@ -38,6 +43,10 @@ return [
38 'adminUrl' => '/admin' 43 'adminUrl' => '/admin'
39 44
40 ], 45 ],
  46 + 'session' => [
  47 + 'name' => 'PHPBACKSESSID',
  48 + 'savePath' => __DIR__ . '/../tmp',
  49 + ],
41 50
42 ], 51 ],
43 'params' => $params, 52 'params' => $params,
backend/controllers/NewsController.php
@@ -95,7 +95,7 @@ class NewsController extends BaseController @@ -95,7 +95,7 @@ class NewsController extends BaseController
95 95
96 96
97 97
98 - if ($model->load(Yii::$app->request->post()) /*&& $model->save()*/ ) { 98 + if ($model->load(Yii::$app->request->post()) && $model->save() ) {
99 99
100 if ($model['mail_send'] == '1') { 100 if ($model['mail_send'] == '1') {
101 $sEmails = array(); 101 $sEmails = array();
backend/views/layouts/main.php
@@ -8,6 +8,7 @@ use yii\helpers\Html; @@ -8,6 +8,7 @@ use yii\helpers\Html;
8 8
9 MyAsset::register($this); 9 MyAsset::register($this);
10 ?> 10 ?>
  11 +
11 <?php $this->beginPage() ?> 12 <?php $this->beginPage() ?>
12 <!DOCTYPE html><html lang="<?= Yii::$app->language ?>" > 13 <!DOCTYPE html><html lang="<?= Yii::$app->language ?>" >
13 <head> 14 <head>
common/models/Accounts.php
@@ -13,6 +13,7 @@ use yii\db\ActiveRecord; @@ -13,6 +13,7 @@ use yii\db\ActiveRecord;
13 * @property integer $id 13 * @property integer $id
14 * @property integer $if_manager 14 * @property integer $if_manager
15 * @property string $email 15 * @property string $email
  16 + * @property string $auth_key
16 * @property string $pass 17 * @property string $pass
17 * @property integer $margin_id 18 * @property integer $margin_id
18 * @property string $name 19 * @property string $name
@@ -53,6 +54,11 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -53,6 +54,11 @@ class Accounts extends ActiveRecord implements IdentityInterface
53 public $re_pass; 54 public $re_pass;
54 public $surname; 55 public $surname;
55 public $country_region; 56 public $country_region;
  57 + public $verifyCode;
  58 + public $auth_key;
  59 + public $password_hash;
  60 + public $password_reset_token;
  61 +
56 62
57 /** 63 /**
58 * @inheritdoc 64 * @inheritdoc
@@ -66,6 +72,7 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -66,6 +72,7 @@ class Accounts extends ActiveRecord implements IdentityInterface
66 public function beforeSave() 72 public function beforeSave()
67 { 73 {
68 $this->dt = time(); 74 $this->dt = time();
  75 + $this->name = $this->surname.' '.$this->name;
69 return true; 76 return true;
70 77
71 } 78 }
@@ -89,7 +96,11 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -89,7 +96,11 @@ class Accounts extends ActiveRecord implements IdentityInterface
89 [['email'], 'unique'], 96 [['email'], 'unique'],
90 [['email'], 'email'], 97 [['email'], 'email'],
91 ['re_pass', 'compare', 'compareAttribute' => 'pass'], 98 ['re_pass', 'compare', 'compareAttribute' => 'pass'],
92 - ['dt', 'date', 'format' => 'Y.m.d'] 99 + ['verifyCode', 'captcha'],
  100 + ['dt', 'date', 'format' => 'Y.m.d'],
  101 + [['rating','if_manager','set_manager_id','balance'], 'default', 'value' => '0'],
  102 + [['is_active','margin_id','office_id','is_scribe'], 'default', 'value' => '1'],
  103 + [['comment'], 'default', 'value' => 'Новый пользователь'],
93 ]; 104 ];
94 } 105 }
95 106
@@ -149,56 +160,7 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -149,56 +160,7 @@ class Accounts extends ActiveRecord implements IdentityInterface
149 { 160 {
150 161
151 if ($this->validate()) { 162 if ($this->validate()) {
152 - $this->name = $this->surname.' '.$this->name;  
153 -  
154 - if( $this->is_firm ){  
155 - $this->if_manager = '0';  
156 - $this->margin_id = '1';  
157 - $this->address = '';  
158 - $this->comment = 'Новый пользователь';  
159 - $this->rating = '0';  
160 - $this->is_active = '1';  
161 - $this->last_loginin = '';  
162 - $this->firm_inn = '';  
163 - $this->firm_bank ='';  
164 - $this->balance ='0.00';  
165 - $this->office_id ='1';  
166 - $this->is_scribe ='1';  
167 - $this->set_manager_id ='0';  
168 - $this->phones2='';  
169 - $this->phones3 ='';  
170 - $this->snumb ='';  
171 - $this->firm_ur_adr ='';  
172 - $this->firm_fiz_adr = '';  
173 - $this->firm_code_eg = '';  
174 - $this->firm_rs = '';  
175 - $this->firm_mfo = '';  
176 - $this->firm_site = '';  
177 - }else{  
178 -  
179 - $this->if_manager = '0';  
180 - $this->margin_id = '1';  
181 - $this->address = '';  
182 - $this->comment = 'Новый пользователь';  
183 - $this->rating = '0';  
184 - $this->is_active = '1';  
185 - $this->last_loginin = '';  
186 - $this->firm_inn = '';  
187 - $this->firm_bank ='';  
188 - $this->balance ='0.00';  
189 - $this->office_id ='1';  
190 - $this->is_scribe ='1';  
191 - $this->set_manager_id ='0';  
192 - $this->phones2='';  
193 - $this->phones3 ='';  
194 - $this->snumb ='';  
195 - $this->firm_ur_adr ='';  
196 - $this->firm_fiz_adr = '';  
197 - $this->firm_code_eg = '';  
198 - $this->firm_rs = '';  
199 - $this->firm_mfo = '';  
200 - $this->firm_site = '';  
201 - } 163 +
202 164
203 if ($this->save()) { 165 if ($this->save()) {
204 return $this; 166 return $this;
@@ -224,14 +186,14 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -224,14 +186,14 @@ class Accounts extends ActiveRecord implements IdentityInterface
224 } 186 }
225 187
226 /** 188 /**
227 - * Finds user by username 189 + * Finds user by email
228 * 190 *
229 - * @param string $username 191 + * @param string $email
230 * @return static|null 192 * @return static|null
231 */ 193 */
232 - public static function findByUsername($username) 194 + public static function findByEmail($email)
233 { 195 {
234 - return static::findOne(['name' => $username]); 196 + return static::findOne(['email' => $email]);
235 } 197 }
236 198
237 /** 199 /**
@@ -283,4 +245,27 @@ class Accounts extends ActiveRecord implements IdentityInterface @@ -283,4 +245,27 @@ class Accounts extends ActiveRecord implements IdentityInterface
283 { 245 {
284 $this->password_reset_token = null; 246 $this->password_reset_token = null;
285 } 247 }
  248 +
  249 + /**
  250 + * Finds out if password reset token is valid
  251 + *
  252 + * @param string $token password reset token
  253 + * @return boolean
  254 + */
  255 + public static function isPasswordResetTokenValid($token)
  256 + {
  257 + if (empty($token)) {
  258 + return false;
  259 + }
  260 + $expire = Yii::$app->params['user.passwordResetTokenExpire'];
  261 + $parts = explode('_', $token);
  262 + $timestamp = (int) end($parts);
  263 + return $timestamp + $expire >= time();
  264 + }
  265 +
  266 +
  267 +
  268 +
  269 +
  270 +
286 } 271 }
common/models/AccountsForm.php deleted
1 -<?php  
2 -  
3 -namespace common\models;  
4 -  
5 -use Yii;  
6 -use yii\web\IdentityInterface;  
7 -use yii\base\NotSupportedException;  
8 -use yii\db\ActiveRecord;  
9 -/**  
10 - * This is the model class for table "w_accounts".  
11 - *  
12 - *  
13 - * @property integer $id  
14 - * @property integer $if_manager  
15 - * @property string $email  
16 - * @property string $pass  
17 - * @property integer $margin_id  
18 - * @property string $name  
19 - * @property string $phones  
20 - * @property integer $country  
21 - * @property integer $city  
22 - * @property string $address  
23 - * @property string $comment  
24 - * @property integer $rating  
25 - * @property string $dt  
26 - * @property integer $is_active  
27 - * @property integer $is_firm  
28 - * @property string $last_loginin  
29 - * @property string $firm_inn  
30 - * @property string $firm_bank  
31 - * @property double $balance  
32 - * @property integer $office_id  
33 - * @property integer $is_scribe  
34 - * @property integer $set_manager_id  
35 - * @property string $phones2  
36 - * @property string $phones3  
37 - * @property integer $car  
38 - * @property integer $mod  
39 - * @property string $snumb  
40 - * @property integer $deliveries  
41 - * @property integer $scode  
42 - * @property string $firm_ur_adr  
43 - * @property string $firm_fiz_adr  
44 - * @property string $firm_code_eg  
45 - * @property string $firm_rs  
46 - * @property string $firm_mfo  
47 - * @property string $firm_site  
48 - * @property string $company  
49 - */  
50 -class AccountsForm extends ActiveRecord  
51 -{  
52 -  
53 - public $re_pass;  
54 - public $surname;  
55 - public $verifyCode;  
56 - public $country_region;  
57 -  
58 - /**  
59 - * @inheritdoc  
60 - */  
61 - public static function tableName()  
62 - {  
63 - return 'w_accounts';  
64 - }  
65 -  
66 -  
67 -  
68 - /**  
69 - * @inheritdoc  
70 - */  
71 - public function rules()  
72 - {  
73 - return [  
74 - [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'],  
75 - [['company','email', 'pass', 'name','surname', 'phones',], 'required'],  
76 - [['comment'], 'string'],  
77 - [['balance'], 'number'],  
78 - [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150],  
79 - [['pass','re_pass'], 'string', 'max' => 30],  
80 - [['phones', 'phones2', 'phones3'], 'string', 'max' => 50],  
81 - [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254],  
82 - [['last_loginin'], 'string', 'max' => 15],  
83 - [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255],  
84 - [['email'], 'unique'],  
85 - [['email'], 'email'],  
86 - ['re_pass', 'compare', 'compareAttribute' => 'pass'],  
87 - ['verifyCode', 'captcha'],  
88 - ['dt', 'date', 'format' => 'Y.m.d']  
89 - ];  
90 - }  
91 -  
92 - /**  
93 - * @inheritdoc  
94 - */  
95 - public function attributeLabels()  
96 - {  
97 - return [  
98 - 'id' => 'ID',  
99 - 'if_manager' => 'Статус менеджера',  
100 - 'email' => 'E-mail (Логин)',  
101 - 'pass' => 'Пароль',  
102 - 'margin_id' => 'Тип цены',  
103 - 'name' => 'Имя',  
104 - 'phones' => 'Телефоны',  
105 - 'country' => Yii::t('app', 'Country'),  
106 - 'city' =>'Город',  
107 - 'address' => 'Адрес',  
108 - 'comment' => 'Комментарий',  
109 - 'rating' => Yii::t('app', 'Rating'),  
110 - 'dt' =>'Дата регистрации',  
111 - 'is_active' => 'Активный',  
112 - 'is_firm' => 'Юридическое лицо',  
113 - 'last_loginin' => Yii::t('app', 'Last Loginin'),  
114 - 'firm_inn' => 'ИНН',  
115 - 'firm_bank' => 'Банк',  
116 - 'balance' => Yii::t('app', 'Balance'),  
117 - 'office_id' => Yii::t('app', 'Office ID'),  
118 - 'is_scribe' => 'Подписка',  
119 - 'set_manager_id' => 'Персональный менеджер',  
120 - 'phones2' => 'Телефоны 2',  
121 - 'phones3' => 'Телефоны 3',  
122 - 'car' => Yii::t('app', 'Car'),  
123 - 'mod' => Yii::t('app', 'Mod'),  
124 - 'snumb' => 'snumb',  
125 - 'deliveries' => Yii::t('app', 'Deliveries'),  
126 - 'scode' => 'Код в 1С',  
127 - 'firm_ur_adr' => 'Юридический адрес',  
128 - 'firm_fiz_adr' => 'Физический адрес',  
129 - 'firm_code_eg' => 'Код ЭГ',  
130 - 'firm_rs' => 'Расчётный счёт',  
131 - 'firm_mfo' => 'МФО',  
132 - 'firm_site' => 'Сайт',  
133 - 'company' => 'Название фирмы',  
134 - 'country_region' => 'Регион'  
135 - ];  
136 - }  
137 -  
138 -  
139 -}  
common/models/User.php
@@ -130,6 +130,7 @@ class User extends ActiveRecord implements IdentityInterface @@ -130,6 +130,7 @@ class User extends ActiveRecord implements IdentityInterface
130 */ 130 */
131 public function getAuthKey() 131 public function getAuthKey()
132 { 132 {
  133 +
133 return $this->auth_key; 134 return $this->auth_key;
134 } 135 }
135 136
@@ -138,6 +139,7 @@ class User extends ActiveRecord implements IdentityInterface @@ -138,6 +139,7 @@ class User extends ActiveRecord implements IdentityInterface
138 */ 139 */
139 public function validateAuthKey($authKey) 140 public function validateAuthKey($authKey)
140 { 141 {
  142 +
141 return $this->getAuthKey() === $authKey; 143 return $this->getAuthKey() === $authKey;
142 } 144 }
143 145
common/models/UserLoginForm.php 0 → 100755
  1 +<?php
  2 +namespace common\models;
  3 +
  4 +use Yii;
  5 +use yii\base\Model;
  6 +
  7 +/**
  8 + * Login form
  9 + */
  10 +class UserLoginForm extends Model
  11 +{
  12 + public $email;
  13 + public $pass;
  14 + public $rememberMe = true;
  15 +
  16 + private $_user;
  17 +
  18 +
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function rules()
  23 + {
  24 + return [
  25 + // email and password are both required
  26 + [['email', 'pass'], 'required'],
  27 + // rememberMe must be a boolean value
  28 + ['rememberMe', 'boolean'],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Validates the password.
  34 + * This method serves as the inline validation for password.
  35 + *
  36 + * @param string $attribute the attribute currently being validated
  37 + * @param array $params the additional name-value pairs given in the rule
  38 + */
  39 + public function validatePassword($attribute, $params)
  40 + {
  41 + if (!$this->hasErrors()) {
  42 + $user = $this->getUser();
  43 + if (!$user || !$user->validatePassword($this->password)) {
  44 + $this->addError($attribute, 'Incorrect email or password.');
  45 + }
  46 + }
  47 + }
  48 +
  49 + /**
  50 + * Logs in a user using the provided email and password.
  51 + *
  52 + * @return boolean whether the user is logged in successfully
  53 + */
  54 + public function login()
  55 + {
  56 +
  57 + if ($this->validate()) {
  58 + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
  59 + } else {
  60 + return false;
  61 + }
  62 + }
  63 +
  64 + /**
  65 + * Finds user by [[email]]
  66 + *
  67 + * @return User|null
  68 + */
  69 + protected function getUser()
  70 + {
  71 + if ($this->_user === null) {
  72 + $this->_user = Accounts::findByEmail($this->email);
  73 + }
  74 +
  75 + return $this->_user;
  76 + }
  77 +}
console/migrations/m151201_151524_add_field_auth_key_for_accounts.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Schema;
  4 +use yii\db\Migration;
  5 +
  6 +class m151201_151524_add_field_auth_key_for_accounts extends Migration
  7 +{
  8 + public function up()
  9 + {
  10 + $view = <<< MySQL
  11 + ALTER TABLE `italautocomua`.`w_accounts`
  12 + ADD COLUMN `auth_key` VARCHAR(255) NULL AFTER `email`;
  13 +MySQL;
  14 + $this->execute($view);
  15 + }
  16 +
  17 + public function down()
  18 + {
  19 + echo "m151201_151524_add_field_auth_key_for_accounts cannot be reverted.\n";
  20 +
  21 + return false;
  22 + }
  23 +
  24 + /*
  25 + // Use safeUp/safeDown to run migration code within a transaction
  26 + public function safeUp()
  27 + {
  28 + }
  29 +
  30 + public function safeDown()
  31 + {
  32 + }
  33 + */
  34 +}
frontend/config/main.php
@@ -13,16 +13,25 @@ return [ @@ -13,16 +13,25 @@ return [
13 'controllerNamespace' => 'frontend\controllers', 13 'controllerNamespace' => 'frontend\controllers',
14 'components' => [ 14 'components' => [
15 'user' => [ 15 'user' => [
16 - 'identityClass' => 'common\models\User', 16 + 'identityClass' => 'common\models\Accounts',
17 'enableAutoLogin' => true, 17 'enableAutoLogin' => true,
  18 + 'identityCookie' => [
  19 + 'name' => '_frontendUser', // unique for frontend
  20 + ]
18 ], 21 ],
19 'request'=>[ 22 'request'=>[
20 - 23 + 'cookieValidationKey' => 'ndahjhjjidasuidrqeswuiuirqw89',
  24 + 'csrfParam' => '_frontendCSRF',
21 'class' => 'common\components\Request', 25 'class' => 'common\components\Request',
22 26
23 'web'=> '/frontend/web' 27 'web'=> '/frontend/web'
24 28
25 ], 29 ],
  30 + 'session' => [
  31 + 'name' => 'PHPFRONTSESSID',
  32 + 'savePath' => __DIR__ . '/../tmp',
  33 +
  34 + ],
26 'log' => [ 35 'log' => [
27 'traceLevel' => YII_DEBUG ? 3 : 0, 36 'traceLevel' => YII_DEBUG ? 3 : 0,
28 'targets' => [ 37 'targets' => [
frontend/controllers/AccountsController.php 0 → 100644
  1 +<?php
  2 +namespace frontend\controllers;
  3 +
  4 +
  5 +use common\models\Accounts;
  6 +use Yii;
  7 +use common\models\News;
  8 +use yii\data\ActiveDataProvider;
  9 +use yii\filters\AccessControl;
  10 +use yii\web\Controller;
  11 +use yii\web\NotFoundHttpException;
  12 +
  13 +
  14 +/**
  15 + * Site controller
  16 + */
  17 +class AccountsController extends Controller
  18 +{
  19 + public $layout = '/internal';
  20 +
  21 +
  22 + public function behaviors()
  23 + {
  24 + return [
  25 + 'access' => [
  26 + 'class' => AccessControl::className(),
  27 + 'rules' => [
  28 + [
  29 + 'actions' => ['cabinet',],
  30 + 'allow' => true,
  31 + 'roles' => ['@'],
  32 + ],
  33 + ],
  34 + ],
  35 + ];
  36 + }
  37 +
  38 +
  39 + public function actionCabinet()
  40 + {
  41 +
  42 + return $this->render('cabinet',[
  43 + 'model' => $this->findModel(Yii::$app->user->identity->id)
  44 + ]);
  45 + }
  46 +
  47 + public function actionIndex()
  48 + {
  49 + $dataProvider = new ActiveDataProvider([
  50 + 'query' => News::find()->where(['is_active'=>1]),
  51 + 'pagination' => [
  52 + 'pageSize' => 16,
  53 + ],
  54 +
  55 + ]);
  56 + return $this->render('index',[
  57 + 'dataProvider' => $dataProvider
  58 + ]);
  59 + }
  60 +
  61 + public function actionView($translit)
  62 + {
  63 +
  64 + $activeNews = $this->findModel($translit);
  65 + $next_news = News::find()->where(['is_active'=>1])->andWhere('id > :id',[':id' => $activeNews->id])->one();
  66 + $prev_news = News::find()->where(['is_active'=>1])->andWhere('id < :id',[':id' => $activeNews->id])->one();
  67 +
  68 + return $this->render('view', [
  69 + 'model' => $activeNews,
  70 + 'next_news' => $next_news instanceof News ? $next_news : '',
  71 + 'prev_news' => $prev_news instanceof News ? $prev_news : ''
  72 + ]);
  73 + }
  74 +
  75 + protected function findModel($id)
  76 + {
  77 +
  78 + if (($model = Accounts::findOne(["id"=>$id])) !== null) {
  79 + return $model;
  80 + } else {
  81 + throw new NotFoundHttpException('The requested page does not exist.');
  82 + }
  83 + }
  84 +
  85 +
  86 +
  87 +
  88 +
  89 +}
frontend/controllers/SiteController.php
@@ -2,13 +2,12 @@ @@ -2,13 +2,12 @@
2 namespace frontend\controllers; 2 namespace frontend\controllers;
3 3
4 use common\models\Accounts; 4 use common\models\Accounts;
5 -use common\models\AccountsForm;  
6 use common\models\News; 5 use common\models\News;
7 use common\models\Slider; 6 use common\models\Slider;
8 use common\models\Team; 7 use common\models\Team;
9 use common\models\TeamGroup; 8 use common\models\TeamGroup;
10 use Yii; 9 use Yii;
11 -use common\models\LoginForm; 10 +use common\models\UserLoginForm;
12 use frontend\models\PasswordResetRequestForm; 11 use frontend\models\PasswordResetRequestForm;
13 use frontend\models\ResetPasswordForm; 12 use frontend\models\ResetPasswordForm;
14 use frontend\models\SignupForm; 13 use frontend\models\SignupForm;
@@ -51,6 +50,7 @@ class SiteController extends Controller @@ -51,6 +50,7 @@ class SiteController extends Controller
51 */ 50 */
52 public function actionIndex() 51 public function actionIndex()
53 { 52 {
  53 +
54 $this->layout = '/outer'; 54 $this->layout = '/outer';
55 55
56 $news_list = News::find()->where(['is_active'=>1])->limit(3)->all(); 56 $news_list = News::find()->where(['is_active'=>1])->limit(3)->all();
@@ -127,11 +127,6 @@ class SiteController extends Controller @@ -127,11 +127,6 @@ class SiteController extends Controller
127 return $this->render('busket_step2'); 127 return $this->render('busket_step2');
128 } 128 }
129 129
130 - public function actionCabinet()  
131 - {  
132 - $this->layout = '/internal';  
133 - return $this->render('cabinet');  
134 - }  
135 130
136 public function actionCatalogMarokStep2() 131 public function actionCatalogMarokStep2()
137 { 132 {
@@ -272,14 +267,19 @@ class SiteController extends Controller @@ -272,14 +267,19 @@ class SiteController extends Controller
272 */ 267 */
273 public function actionLogin() 268 public function actionLogin()
274 { 269 {
  270 +
  271 +
275 if (!\Yii::$app->user->isGuest) { 272 if (!\Yii::$app->user->isGuest) {
  273 +
276 return $this->goHome(); 274 return $this->goHome();
277 } 275 }
278 276
279 - $model = new LoginForm(); 277 + $model = new UserLoginForm();
  278 +
280 if ($model->load(Yii::$app->request->post()) && $model->login()) { 279 if ($model->load(Yii::$app->request->post()) && $model->login()) {
281 return $this->goBack(); 280 return $this->goBack();
282 } else { 281 } else {
  282 + $this->layout = '/internal';
283 return $this->render('login', [ 283 return $this->render('login', [
284 'model' => $model, 284 'model' => $model,
285 ]); 285 ]);
@@ -334,16 +334,23 @@ class SiteController extends Controller @@ -334,16 +334,23 @@ class SiteController extends Controller
334 */ 334 */
335 public function actionSignup() 335 public function actionSignup()
336 { 336 {
  337 +
  338 + $this->layout = '/internal';
  339 +
337 $model = new Accounts(); 340 $model = new Accounts();
338 341
339 - if ($model->load(Yii::$app->request->post(),'AccountsForm')) { 342 + if ($model->load(Yii::$app->request->post()) ) {
  343 +
  344 + $model->generateAuthKey();
340 345
341 - if ($user = $model->signup()) { 346 + $model->save();
  347 +
  348 + if (Yii::$app->getUser()->login($model)) {
  349 +
  350 + return $this->goHome();
342 351
343 - if (Yii::$app->getUser()->login($user)) {  
344 - return $this->goHome();  
345 - }  
346 } 352 }
  353 +
347 } 354 }
348 355
349 return $this->render('signup', [ 356 return $this->render('signup', [
frontend/views/site/cabinet.php renamed to frontend/views/accounts/cabinet.php
1 <?php 1 <?php
  2 +use \yii\widgets\ActiveForm;
  3 +use \yii\helpers\ArrayHelper;
  4 +use \common\models\DicCities;
  5 +use \common\models\Deliveries;
2 6
3 $this->registerCssFile('/css/about_company.css'); 7 $this->registerCssFile('/css/about_company.css');
4 $this->registerCssFile('/css/style/notepad.css'); 8 $this->registerCssFile('/css/style/notepad.css');
@@ -6,14 +10,11 @@ $this-&gt;registerCssFile(&#39;/css/style/my_profile.css&#39;); @@ -6,14 +10,11 @@ $this-&gt;registerCssFile(&#39;/css/style/my_profile.css&#39;);
6 $this->registerCssFile('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'); 10 $this->registerCssFile('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
7 $this->registerJsFile('//code.jquery.com/ui/1.11.4/jquery-ui.js'); 11 $this->registerJsFile('//code.jquery.com/ui/1.11.4/jquery-ui.js');
8 12
  13 +$this->title = 'Мой профиль';
9 $this->params['breadcrumbs'][] = $this->title; 14 $this->params['breadcrumbs'][] = $this->title;
10 ?> 15 ?>
11 16
12 <div class="vin"> 17 <div class="vin">
13 - <a href="" class="navigation">Италавто</a>  
14 - <img src="/images/arrow_dots.png" class='arrow_go'>  
15 - <span>Мой профиль</span>  
16 -  
17 <p class="vin_article">Мой профиль</p> 18 <p class="vin_article">Мой профиль</p>
18 <div class='side_menu'> 19 <div class='side_menu'>
19 <ul class="side_menu-list" role="tablist"> 20 <ul class="side_menu-list" role="tablist">
@@ -30,56 +31,52 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -30,56 +31,52 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
30 <div role="tabpanel" class="tab-pane active" id="profile"> 31 <div role="tabpanel" class="tab-pane active" id="profile">
31 <p class="tab-content_header">Личные данные</p> 32 <p class="tab-content_header">Личные данные</p>
32 <div class="myprofile"> 33 <div class="myprofile">
33 - <button class="purple top">Изменить пароль</button>  
34 - <form class="my_profile">  
35 -  
36 -  
37 - <div class="input2">  
38 - <label for="login">Мой логин</label>  
39 - <input type="text" name="login" id="login" placeholder="Логин" minlength="2" required=""  
40 - </div>  
41 - <div class="input2">  
42 - <label for="name">Имя</label>  
43 - <input type="text" name="name" id="name" placeholder="Имя" minlength="2" required="" >  
44 - </div>  
45 - <div class="input2">  
46 - <label for="familyname">Фамилия</label>  
47 - <input type="text" name="familyname" id="familyname" placeholder="Фамилия" minlength="2" required="">  
48 - </div>  
49 - <div class="input2">  
50 - <label for="area_search">Перевозчик:</label>  
51 - <select class='provider area_search' required="">  
52 - <option value="1">Автолюкс до 16.20</option>  
53 - <option value="2">Выбери меня!</option>  
54 - <option value="3">Выбери меня!</option>  
55 - <option value="5">Меня!</option>  
56 - <option value="4">Меня</option>  
57 - </select>  
58 - </div>  
59 - <div class="input2">  
60 - <label for="tel">Телефон</label>  
61 - <input type="text" name="tel" id="tel" placeholder="Телефон" minlength="7" required="">  
62 - </div>  
63 - <p class="add_telephone2" style="font-size: 14px;  
64 - margin-right: 12px;  
65 - margin-top: 10px;">добавить еще 1 телефон</p>  
66 - <div class="input1">  
67 - <input type="telephone" name="telephone" class="telephone_registration_add" placeholder="Телефон" style="display: block;">  
68 - </div>  
69 - <div class="input2">  
70 - <label for="cod">Код клиента</label>  
71 - <input type="text" name="cod" id="cod" class="grey" disabled="">  
72 - </div>  
73 - <div class='input2 '>  
74 - <label for="consult">Мой консультант</label>  
75 - <input type="text" name="consult" id="consult" class="grey" disabled="" >  
76 - </div>  
77 -  
78 -  
79 - </div>  
80 - <button class="purple_white">Отмена</button>  
81 - <button class="purple">Изменить</button>  
82 - </form> 34 + <button class="purple top">Изменить пароль</button>
  35 +
  36 + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data','class'=>'my_profile'], 'method'=>'post','action' => '/site/signup',]); ?>
  37 +
  38 + <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0']) ?>
  39 +
  40 + <?= $form->field($model, 'company')->hiddenInput(['value'=>'Частное лицо']) ?>
  41 +
  42 + <?= $form->field($model, 'name',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Имя']) ?>
  43 +
  44 + <?= $form->field($model, 'surname',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Фамилия']) ?>
  45 +
  46 + <?= $form->field($model, 'phones',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'Телефон']) ?>
  47 +
  48 + <?= $form->field($model, 'email',['options'=>['class'=>'input2']])->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration']) ?>
  49 +
  50 + <?= $form->field($model, 'pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>
  51 +
  52 + <?= $form->field($model, 're_pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>
  53 +
  54 + <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  55 + ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'),
  56 + ['prompt' => 'Выберите область']
  57 + );
  58 + ?>
  59 +
  60 + <?= $form->field($model, 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  61 + [],
  62 + ['prompt' => 'Выберите город']
  63 + );
  64 + ?>
  65 +
  66 + <?= $form->field($model, 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  67 + ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'),
  68 + ['prompt' => 'Выберите тип перевозки']
  69 + );
  70 + ?>
  71 +
  72 +
  73 + <button class="purple_white">Отмена</button>
  74 + <button class="purple">Изменить</button>
  75 + <?php ActiveForm::end(); ?>
  76 +
  77 +
  78 +
  79 + </div>
83 80
84 81
85 </div> 82 </div>
frontend/views/layouts/main.php
@@ -5,22 +5,17 @@ @@ -5,22 +5,17 @@
5 5
6 use yii\helpers\Html; 6 use yii\helpers\Html;
7 use yii\widgets\ActiveForm; 7 use yii\widgets\ActiveForm;
8 -use yii\bootstrap\Nav;  
9 -use yii\bootstrap\NavBar;  
10 -use yii\widgets\Breadcrumbs;  
11 -use frontend\assets\AppAsset;  
12 -use common\widgets\Alert;  
13 use \yii\widgets\Menu; 8 use \yii\widgets\Menu;
14 use \yii\helpers\Url; 9 use \yii\helpers\Url;
15 use common\models\Callback; 10 use common\models\Callback;
16 use \common\models\Accounts; 11 use \common\models\Accounts;
17 -use \common\models\AccountsForm;  
18 use \yii\helpers\ArrayHelper; 12 use \yii\helpers\ArrayHelper;
19 use \common\models\DicCities; 13 use \common\models\DicCities;
20 use \common\models\Deliveries; 14 use \common\models\Deliveries;
21 use yii\captcha\Captcha; 15 use yii\captcha\Captcha;
22 - 16 +use \common\models\UserLoginForm;
23 ?> 17 ?>
  18 +
24 <?php $this->beginPage() ?> 19 <?php $this->beginPage() ?>
25 <!DOCTYPE html> 20 <!DOCTYPE html>
26 <html lang="<?= Yii::$app->language ?>"> 21 <html lang="<?= Yii::$app->language ?>">
@@ -101,13 +96,7 @@ use yii\captcha\Captcha; @@ -101,13 +96,7 @@ use yii\captcha\Captcha;
101 96
102 <div class="contacts"> 97 <div class="contacts">
103 <?= Html::a(Html::img('/images/logo.png'),['/']) ?> 98 <?= Html::a(Html::img('/images/logo.png'),['/']) ?>
104 - <!-- Split button -->  
105 99
106 - <!-- <select class='dropdown_contacts'>  
107 - <option value="mts" data-image="/images/mts.png"></option>  
108 - <option value="life"></option>  
109 - <option value="kyivstar"></option>  
110 - </select> -->  
111 <p class="number"><span class="number_space">050 </span>-0400-192</p> 100 <p class="number"><span class="number_space">050 </span>-0400-192</p>
112 <div class="phone_select"> 101 <div class="phone_select">
113 <img src="/images/mts.png" class="mts"> 102 <img src="/images/mts.png" class="mts">
@@ -178,13 +167,21 @@ use yii\captcha\Captcha; @@ -178,13 +167,21 @@ use yii\captcha\Captcha;
178 </div> 167 </div>
179 </div> 168 </div>
180 </div> 169 </div>
181 -  
182 -  
183 -  
184 <div class="user"> 170 <div class="user">
  171 +
  172 + <?php if (Yii::$app->user->isGuest):?>
185 <img src="/images/user.png"> 173 <img src="/images/user.png">
186 <p>Войти</p> 174 <p>Войти</p>
187 <a href="" class="own_page" id="go">Личный кабинет</a> 175 <a href="" class="own_page" id="go">Личный кабинет</a>
  176 + <?php else : ?>
  177 +
  178 + <img src="/images/user.png">
  179 + <p><?=Yii::$app->user->identity->name?></p>
  180 + <?= Html::a('Личный кабинет',['accounts/cabinet'],['class'=>'own_page']) ?>
  181 + <?php endif; ?>
  182 +
  183 +
  184 +
188 </div> 185 </div>
189 186
190 <div class="box"> 187 <div class="box">
@@ -352,25 +349,36 @@ use yii\captcha\Captcha; @@ -352,25 +349,36 @@ use yii\captcha\Captcha;
352 349
353 <div id="modal_form" style="opacity: 0; top: 45%; display: none;"> 350 <div id="modal_form" style="opacity: 0; top: 45%; display: none;">
354 <span id="modal_close"><img src="/images/close_form.png"></span> 351 <span id="modal_close"><img src="/images/close_form.png"></span>
355 - <form method="get" class="cmxform" action="" id="enter_form">  
356 - <fieldset>  
357 - <h3>Вход в личный кабинет</h3>  
358 -  
359 -  
360 -  
361 - <input type="email" name="email" id="email" placeholder="email" minlength="" required=""><span class="star">*</span> 352 + <?php $form = ActiveForm::begin(['id' => 'enter_form','class'=>'cmxform','action' => '/site/login']); ?>
  353 + <fieldset>
  354 + <h3>Вход в личный кабинет</h3>
  355 + <?= $form->field(new UserLoginForm(), 'email')->label(false) ?>
  356 + <?= $form->field(new UserLoginForm(), 'pass')->passwordInput()->label(false) ?>
  357 + <?= $form->field(new UserLoginForm(), 'rememberMe')->checkbox() ?>
  358 + <?= Html::a('Забыли пароль?', ['site/request-password-reset']) ?>
  359 + <?= Html::submitButton('Submit', ['class' => 'purple', 'name' => 'login-button']) ?>
  360 + </fieldset>
  361 + <?php ActiveForm::end(); ?>
362 362
363 - <input type="password" name="password" id="password" placeholder="Пароль" minlength="5" maxlength="12" required=""><span class="star1">*</span>  
364 - <input type="checkbox" id="assurance" class="filter-two" name="assurance" value="assurance" >  
365 - <label for="assurance"><span></span><a href=""></a></label>  
366 -  
367 - <a href="" class="own_page1">Запомнить меня</a>  
368 - <a href="" class="own_page2">Забыли пароль?</a>  
369 - <button class="purple" type="submit" value="Submit">Войти</button>  
370 -  
371 -  
372 - </fieldset>  
373 - </form> 363 +<!-- <form method="get" class="cmxform" action="" id="enter_form">-->
  364 +<!-- <fieldset>-->
  365 +<!---->
  366 +<!---->
  367 +<!---->
  368 +<!---->
  369 +<!-- <input type="email" name="email" id="email" placeholder="email" minlength="" required=""><span class="star">*</span>-->
  370 +<!---->
  371 +<!-- <input type="password" name="password" id="password" placeholder="Пароль" minlength="5" maxlength="12" required=""><span class="star1">*</span>-->
  372 +<!-- <input type="checkbox" id="assurance" class="filter-two" name="assurance" value="assurance" >-->
  373 +<!-- <label for="assurance"><span></span><a href=""></a></label>-->
  374 +<!---->
  375 +<!-- <a href="" class="own_page1">Запомнить меня</a>-->
  376 +<!-- <a href="" class="own_page2">Забыли пароль?</a>-->
  377 +<!-- <button class="purple" type="submit" value="Submit">Войти</button>-->
  378 +<!---->
  379 +<!---->
  380 +<!-- </fieldset>-->
  381 +<!-- </form>-->
374 382
375 <a href="" class="own_page3" class="btn btn-lg btn-default" data-toggle="modal" 383 <a href="" class="own_page3" class="btn btn-lg btn-default" data-toggle="modal"
376 data-target="#basicModal" 384 data-target="#basicModal"
@@ -400,43 +408,43 @@ use yii\captcha\Captcha; @@ -400,43 +408,43 @@ use yii\captcha\Captcha;
400 <div class="registration_holder"> 408 <div class="registration_holder">
401 409
402 <div class="registration_for_person"> 410 <div class="registration_for_person">
403 - <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => 'site/signup']); ?> 411 + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => '/site/signup']); ?>
404 412
405 - <?= $form->field(new AccountsForm(), 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?> 413 + <?= $form->field(new Accounts(), 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?>
406 414
407 - <?= $form->field(new AccountsForm(), 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?> 415 + <?= $form->field(new Accounts(), 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?>
408 416
409 - <?= $form->field(new AccountsForm(), 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?> 417 + <?= $form->field(new Accounts(), 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?>
410 418
411 - <?= $form->field(new AccountsForm(), 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?> 419 + <?= $form->field(new Accounts(), 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?>
412 420
413 - <?= $form->field(new AccountsForm(), 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?> 421 + <?= $form->field(new Accounts(), 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?>
414 422
415 - <?= $form->field(new AccountsForm(), 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?> 423 + <?= $form->field(new Accounts(), 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?>
416 424
417 - <?= $form->field(new AccountsForm(), 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> 425 + <?= $form->field(new Accounts(), 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?>
418 426
419 - <?= $form->field(new AccountsForm(), 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?> 427 + <?= $form->field(new Accounts(), 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?>
420 428
421 - <?= $form->field(new AccountsForm(), 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList( 429 + <?= $form->field(new Accounts(), 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
422 ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'), 430 ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'),
423 ['prompt' => 'Выберите область'] 431 ['prompt' => 'Выберите область']
424 )->label(false); 432 )->label(false);
425 ?> 433 ?>
426 434
427 - <?= $form->field(new AccountsForm(), 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList( 435 + <?= $form->field(new Accounts(), 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
428 [], 436 [],
429 ['prompt' => 'Выберите город'] 437 ['prompt' => 'Выберите город']
430 )->label(false); 438 )->label(false);
431 ?> 439 ?>
432 440
433 - <?= $form->field(new AccountsForm(), 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList( 441 + <?= $form->field(new Accounts(), 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
434 ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'), 442 ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'),
435 ['prompt' => 'Выберите тип перевозки'] 443 ['prompt' => 'Выберите тип перевозки']
436 )->label(false); 444 )->label(false);
437 ?> 445 ?>
438 446
439 - <?= $form->field(new AccountsForm(), 'verifyCode')->widget(Captcha::className(), [ 447 + <?= $form->field(new Accounts(), 'verifyCode')->widget(Captcha::className(), [
440 'options'=>['placeholder'=>'Введите код' ], 448 'options'=>['placeholder'=>'Введите код' ],
441 'template' => '<div>{input}</div><div class="row"><div class="col-lg-3">{image}</div></div>', 449 'template' => '<div>{input}</div><div class="row"><div class="col-lg-3">{image}</div></div>',
442 ])->label(false); ?> 450 ])->label(false); ?>
frontend/views/site/login.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\widgets\ActiveForm;
  4 +use \yii\helpers\Html;
  5 +use common\models\UserLoginForm;
  6 +use \yii\helpers\ArrayHelper;
  7 +use \common\models\DicCities;
  8 +use \common\models\Deliveries;
  9 +use yii\captcha\Captcha;
  10 +
  11 +
  12 +?>
  13 +<div id="modal_form_registration" >
  14 + <?php $form = ActiveForm::begin(['id' => 'enter_form','class'=>'cmxform','action' => '/site/login']); ?>
  15 + <fieldset>
  16 + <h3>Вход в личный кабинет</h3>
  17 + <?= $form->field(new UserLoginForm(), 'email')->label(false) ?>
  18 + <?= $form->field(new UserLoginForm(), 'pass')->passwordInput()->label(false) ?>
  19 + <?= $form->field(new UserLoginForm(), 'rememberMe')->checkbox() ?>
  20 + <?= Html::a('Забыли пароль?', ['site/request-password-reset']) ?>
  21 + <?= Html::submitButton('Submit', ['class' => 'purple', 'name' => 'login-button']) ?>
  22 + </fieldset>
  23 + <?php ActiveForm::end(); ?>
  24 +</div>
0 \ No newline at end of file 25 \ No newline at end of file
frontend/views/site/provider.php deleted
1 -<?php  
2 -  
3 -$this->registerCssFile('/css/style/optovikam.css');  
4 -$this->title = "Поставщикам";  
5 -$this->params['breadcrumbs'][] = $this->title;  
6 -?>  
7 -  
8 -  
9 -  
10 -  
11 -  
12 -<div class="main-vin">  
13 -  
14 - <p class="vin_article">Поставщикам</p>  
15 -  
16 -<div class="choose_tovar">  
17 -<p class="choose_tovar-inviting">Приглашаем к сотрудничеству поставщиков товара.</p>  
18 -  
19 -<div class="choose_tovar-list">  
20 -<p>Основные положения сотрудничества:</p>  
21 -<ul>  
22 - <li>Работа с Поставщиками ведется на основании Договора. Предложение прайсов к загрузке на сайт означает согласие с положениями данного Договора.</li>  
23 - <li>Загружаются прайсы только прямых поставщиков, т.е. владельцев товара. Данные интернет-магазинов, предлагающих к размещению “чужой” товар, не публикуются.</li>  
24 - <li>Возможность возврата товара на протяжении 17 дней (14 + 3 дня дорога).</li>  
25 - <li>Поддержка гарантии на поставляемый товар.</li>  
26 -</ul>  
27 -</div>  
28 -  
29 -<div class="choose_tovar-list">  
30 -<p>Требования к прайсам:</p>  
31 -<ul>  
32 - <li>Прайсы-листы принимаются на электронный ящик <a href="">price@italauto.com.ua</a> с указанием в темы письма - Прайс_Название_Поставщика.</li>  
33 - <li>Обновление ежедневно.</li>  
34 - <li>Формат представления следующий: (<a href="">Пример_Прайс_Поставщик.</a>)</li>  
35 - <li>Цена прайса в евро.</li>  
36 -</ul>  
37 -</div>  
38 -  
39 -<div class="choose_tovar-list">  
40 -<p>Требования к товару:</p>  
41 -<ul>  
42 - <li>Товар принимается с сопроводительной накладной от Поставщика.</li>  
43 - <li>Упаковка и содержимое товара должны соответствовать бренду.</li>  
44 -</ul>  
45 -</div>  
46 -  
47 -<div class="choose_tovar-list">  
48 -<table>  
49 - <tbody><tr>  
50 - <td class="team_header">Контакты для предложений о сотрудничестве:</td>  
51 - </tr>  
52 - <tr>  
53 - <td class="team_contacts"><a href=""><img src="/images/envelope.png">oleg@italauto.com.ua</a></td>  
54 - </tr>  
55 - <tr>  
56 - <td class="team_contacts"><a href=""><img src="/images/telephone_ico.png">044-593-9051 доб.4201</a></td>  
57 - </tr>  
58 - <tr>  
59 - <td class="team_contacts"><a href=""><img src="/images/skype.png">oleg-italauto</a></td>  
60 - </tr>  
61 -  
62 - </tbody></table>  
63 -</div>  
64 -</div>  
65 -</div>  
frontend/views/site/registration_form.php deleted
1 -<html xmlns="http://www.w3.org/1999/html"><head>  
2 -<meta charset="utf-8">  
3 -<link href="http://fonts.googleapis.com/css?family=Ubuntu:400,300,500,700" rel="stylesheet" type="text/css">  
4 -<link rel="stylesheet" type="text/css" href="style.css">  
5 -<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">  
6 -<link rel="stylesheet" type="text/css" href="bootstrap1/css/bootstrap.css">  
7 -  
8 -<script type="text/javascript" async="" src="./modal/watch.js"></script>  
9 -<script src="./modal/jquery.min.js"></script>  
10 -<script src="./perfect-scrollbar/js/perfect-scrollbar.js"></script>  
11 -<link rel="stylesheet" href="perfect-scrollbar/css/perfect-scrollbar.css">  
12 -<script src="./js/ital_auto.js"></script>  
13 -<script src="./js/script.js"></script>  
14 -<link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css">  
15 -</head>  
16 -  
17 -  
18 -<body>  
19 -  
20 -<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">  
21 - <div class="modal-dialog" role="document">  
22 - <div class="modal-content">  
23 - <div class="modal-header">  
24 - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>  
25 - </div>  
26 - <div class="modal-body">  
27 - <div id="modal_form_registration" >  
28 - <span id="modal_close"><img src="/images/close_form.png"></span>  
29 - <form action="" method="post" id="registration_form">  
30 - <h3>Заявка на регистрацию</h3>  
31 - <div class="purple_registration active_button" style="margin-left:65px; border-radius:4px 0 0 0 " id="person"><p>Частное лицо</p></div><div id="company" class="purple_registration"><p>Оптовик</p></div>  
32 - <div class="registration_holder">  
33 -  
34 - <div class="registration_for_person">  
35 -  
36 -  
37 - <input type="text" name="familyname" id="family_name" placeholder="Фамилия  
38 - " minlength="2" required="">  
39 -  
40 - <input name="name" id="name" placeholder="Имя" minlength="2" type="text" required="">  
41 - <input type="email" name="email" id="email_registration" placeholder="email" minlength="10" required="">  
42 -  
43 - <input type="phone" name="telephone" id="telephone_registration" placeholder="Телефон" minlength="7" required="">  
44 - <input type="telephone" name="telephone" id="telephone_registration_add" placeholder="Телефон">  
45 - <p class="add_telephone" style="font-size: 14px;  
46 - margin-right: 12px;  
47 - margin-top: 10px;">добавить еще 1 телефон</p>  
48 - <p>Фактический адрес</p>  
49 - <div class="selectize_item2">  
50 -  
51 -  
52 - <select class="area">  
53 - <option value="" disabled="" selected="">Выберите область</option>  
54 - <option value="2">Выбери меня!</option>  
55 - <option value="3">Выбери меня!</option>  
56 - <option value="5">Меня!</option>  
57 - <option value="4">Меня</option>  
58 - </select>  
59 -  
60 - </div>  
61 - <div class="selectize_item2">  
62 -  
63 -  
64 - <select class="city">  
65 - <option value="" disabled="" selected="">Выберите город</option>  
66 - <option value="2">Выбери меня!</option>  
67 - <option value="3">Выбери меня!</option>  
68 - <option value="5">Меня!</option>  
69 - <option value="4">Меня</option>  
70 - </select>  
71 -  
72 - </div>  
73 - <div class="selectize_item2">  
74 -  
75 -  
76 - <select class="steel">  
77 - <option value="" disabled="" selected="">Перевозчик</option>  
78 - <option value="2">Выбери меня!</option>  
79 - <option value="3">Выбери меня!</option>  
80 - <option value="5">Меня!</option>  
81 - <option value="4">Меня</option>  
82 - </select>  
83 -  
84 - </div>  
85 -  
86 - <input type="text" placeholder="Введите код" id="code_input" required="">  
87 - <div class="code_generate">  
88 - <img src="/images/code_generator.png">  
89 - </div>  
90 - <button class="purple" type="submit" value="Submit">Зарегестрироваться</button>  
91 -  
92 -  
93 - </div>  
94 - <div class="registration_for_company">  
95 -  
96 - <input type="text" name="fullname" id="company_name" placeholder="Компания  
97 - " minlength="2" required="">  
98 - <input type="text" name="fullname" id="family_name" placeholder="Фамилия  
99 - " minlength="2" required="">  
100 -  
101 - <input type="" name="name" id="name" placeholder="Имя" minlength="2" required="">  
102 - <input type="email" name="email" id="email_registration" placeholder="email" minlength="10" required="">  
103 -  
104 - <input type="telephone" name="telephone" id="telephone_registration" placeholder="Телефон" minlength="7" required="">  
105 - <input type="telephone" name="telephone" id="telephone_registration_add1" placeholder="Телефон" style="display:none">  
106 - <p class="add_telephone1" style="font-size: 14px;  
107 - margin-right: 12px;  
108 - margin-top: 10px;">добавить еще 1 телефон</p>  
109 - <p>Фактический адрес</p>  
110 - <div class="selectize_item2">  
111 -  
112 -  
113 - <select class="area">  
114 - <option value="" disabled="" selected="">Выберите область</option>  
115 - <option value="2">Выбери меня!</option>  
116 - <option value="3">Выбери меня!</option>  
117 - <option value="5">Меня!</option>  
118 - <option value="4">Меня</option>  
119 - </select>  
120 -  
121 - </div>  
122 - <div class="selectize_item2">  
123 -  
124 -  
125 - <select class="city">  
126 - <option value="" disabled="" selected="">Выберите город</option>  
127 - <option value="2">Выбери меня!</option>  
128 - <option value="3">Выбери меня!</option>  
129 - <option value="5">Меня!</option>  
130 - <option value="4">Меня</option>  
131 - </select>  
132 -  
133 - </div>  
134 - <div class="selectize_item2">  
135 -  
136 -  
137 - <select class="steel">  
138 - <option value="" disabled="" selected="">Перевозчик</option>  
139 - <option value="2">Выбери меня!</option>  
140 - <option value="3">Выбери меня!</option>  
141 - <option value="5">Меня!</option>  
142 - <option value="4">Меня</option>  
143 - </select>  
144 -  
145 - </div>  
146 -  
147 - <input type="text" placeholder="Введите код" id="code_input">  
148 - <div class="code_generate">  
149 - <img src="/images/code_generator.png">  
150 - </div>  
151 - <button class="purple" type="submit" value="Submit">Зарегестрироваться</button>  
152 -  
153 -  
154 - </div>  
155 - </div></form>  
156 -  
157 -  
158 -  
159 -</div>  
160 - </div>  
161 -  
162 - </div>  
163 - </div>  
164 -</div>  
165 -  
166 -</body>  
167 \ No newline at end of file 0 \ No newline at end of file
frontend/views/site/signup.php 0 → 100755
  1 +<?php
  2 +
  3 +use yii\widgets\ActiveForm;
  4 +use \yii\helpers\ArrayHelper;
  5 +use \common\models\DicCities;
  6 +use \common\models\Deliveries;
  7 +use yii\captcha\Captcha;
  8 +
  9 +
  10 +?>
  11 +<div id="modal_form_registration" >
  12 + <h3>Заявка на регистрацию</h3>
  13 + <div class="purple_registration active_button" style=" border-radius:12px 0 0 0 " id="person"><p>Частное лицо</p></div><div id="company" class="purple_registration"><p>Оптовик</p></div>
  14 + <div class="registration_holder">
  15 +
  16 + <div class="registration_for_person">
  17 + <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data'], 'method'=>'post','action' => '/site/signup']); ?>
  18 +
  19 + <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?>
  20 +
  21 + <?= $form->field($model, 'company')->hiddenInput(['value'=>'Частное лицо'])->label(false) ?>
  22 +
  23 + <?= $form->field($model, 'name')->textInput(['maxlength' => 45,'placeholder'=>'Имя'])->label(false) ?>
  24 +
  25 + <?= $form->field($model, 'surname')->textInput(['maxlength' => 45,'placeholder'=>'Фамилия'])->label(false) ?>
  26 +
  27 + <?= $form->field($model, 'phones')->textInput(['maxlength' => 45,'placeholder'=>'Телефон'])->label(false) ?>
  28 +
  29 + <?= $form->field($model, 'email')->textInput(['maxlength' => 45,'placeholder'=>'E-mail','class'=>'form-control telephone_registration'])->label(false) ?>
  30 +
  31 + <?= $form->field($model, 'pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?>
  32 +
  33 + <?= $form->field($model, 're_pass')->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration'])->label(false) ?>
  34 +
  35 + <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  36 + ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'),
  37 + ['prompt' => 'Выберите область']
  38 + )->label(false);
  39 + ?>
  40 +
  41 + <?= $form->field($model, 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  42 + [],
  43 + ['prompt' => 'Выберите город']
  44 + )->label(false);
  45 + ?>
  46 +
  47 + <?= $form->field($model, 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  48 + ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'),
  49 + ['prompt' => 'Выберите тип перевозки']
  50 + )->label(false);
  51 + ?>
  52 +
  53 + <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
  54 + 'options'=>['placeholder'=>'Введите код' ],
  55 + 'template' => '<div>{input}</div><div class="row"><div class="col-lg-3">{image}</div></div>',
  56 + ])->label(false); ?>
  57 +
  58 + <button class="purple" type="submit" value="Submit">Зарегистрироваться</button>
  59 + <?php ActiveForm::end(); ?>
  60 + </div>
  61 +
  62 + </div>
  63 +</div>
0 \ No newline at end of file 64 \ No newline at end of file
frontend/views/site/wholesalers.php deleted
1 -<?php  
2 -  
3 -$this->registerCssFile('/css/style/optovikam.css');  
4 -$this->title = "Оптовикам";  
5 -$this->params['breadcrumbs'][] = $this->title;  
6 -?>  
7 -  
8 -<div class="main-vin">  
9 -  
10 - <p class="vin_article">Оптовикам</p>  
11 -  
12 -<div class="choose_tovar">  
13 -<p class="choose_tovar-inviting">Приглашаем к сотрудничеству СТО, магазины и торгующие организации</p>  
14 -  
15 -<div class="choose_tovar-list">  
16 -<p>Общие положения сотрудничества:</p>  
17 -<ul>  
18 - <li>Работа с Оптовиками ведется на основании Договора. Регистрация на сайте в качестве Оптовика и заказ товара означают согласие с положениями данного Договора.</li>  
19 - <li>Уровень цен и скидок определяется руководством на основании договоренностей с Оптовиком.</li>  
20 - <li>Ответственность за применяемость заказанного товара к автомобилю клиента несет Оптовик. В случае необходимости и возможности мы готовы предоставить консультации по подбору товара.</li>  
21 -</ul>  
22 -</div>  
23 -  
24 -<div class="choose_tovar-list">  
25 -<p>Возврат товара</p>  
26 -<ul>  
27 - <li>Возврат “складского” товара возможен на протяжении 14 дней (включая время на пересылку товара). Товар, привезенный “под клиента” возврату не подлежит.</li>  
28 - <li>Доставка товара осуществляется за счет Оптовика.</li>  
29 - <li>Товар принимается в неповрежденной упаковке. Надписи, скотч и т.д. должны отсутствовать.</li>  
30 - <li>Товар со следами установки возврату не подлежит.</li>  
31 - <li>Cтоимость возвращенного товара учитывается для оплаты следующих заказов.</li>  
32 -</ul>  
33 -</div>  
34 -  
35 -<div class="choose_tovar-list">  
36 -<p>Гарантия</p>  
37 -<ul>  
38 - <li>Оригинальные запчасти поставляются без гарантии. Претензии принимаются только по комплектности товара.</li>  
39 - <li>Гарантия на запчасти производителя Aftermaket (кроме электрических деталей) составляет 14 дней с момента получения товара Оптовиком. Перечень документов, необходимых для предъявления гарантийного случая <a href=''>здесь.</a></li>  
40 -</ul>  
41 -</div>  
42 -  
43 -<div class="choose_tovar-list">  
44 -<p>Доставка товара</p>  
45 -<ul>  
46 - <li>Киевляне – самовывоз со склада Поставщика.</li>  
47 - <li>Регионы – отправка транспортными компаниями (Автолюкс, Гюнсел, Новая Почта).</li>  
48 -</ul>  
49 -</div>  
50 -</div>  
51 -  
52 -</div>  
53 \ No newline at end of file 0 \ No newline at end of file
frontend/web/css/main.css
@@ -264,6 +264,6 @@ div.required:after { content: &quot; *&quot;; @@ -264,6 +264,6 @@ div.required:after { content: &quot; *&quot;;
264 background-position: 100% 46%; 264 background-position: 100% 46%;
265 } 265 }
266 266
267 -.field-accountsform-company{ 267 +.field-accounts-company{
268 display: none; 268 display: none;
269 } 269 }
270 \ No newline at end of file 270 \ No newline at end of file
frontend/web/css/style/my_profile.css
@@ -237,21 +237,6 @@ cursor: pointer; @@ -237,21 +237,6 @@ cursor: pointer;
237 outline: none; 237 outline: none;
238 } 238 }
239 239
240 -.orange {  
241 - height: 28px;  
242 - width: 32px;  
243 - border-radius: 7px;  
244 - border: 1px solid #ffc523;  
245 - margin-bottom: -1px;  
246 - font-size: 11px;  
247 - background-color: #ffc523;  
248 - box-shadow: 0px 4px 0 0px #efb515;  
249 - outline: none;  
250 - cursor: pointer;  
251 - position: initial;  
252 - bottom: 0;  
253 - margin-left: 0;  
254 -}  
255 240
256 .input_date{ 241 .input_date{
257 width:241px; 242 width:241px;
frontend/web/js/main.js
@@ -2,11 +2,11 @@ @@ -2,11 +2,11 @@
2 * Created by vitaliy on 23.11.15. 2 * Created by vitaliy on 23.11.15.
3 */ 3 */
4 $(document).ready(function(){ 4 $(document).ready(function(){
5 - $('#accountsform-country').change(function(){ 5 + $('#accounts-country').change(function(){
6 var region_id = $(this).val(); 6 var region_id = $(this).val();
7 if(region_id){ 7 if(region_id){
8 $.get( "/ajax/get-city", {region_id:region_id}, function( data ) { 8 $.get( "/ajax/get-city", {region_id:region_id}, function( data ) {
9 - var $input = $('#accountsform-city'); 9 + var $input = $('#accounts-city');
10 $input.empty(); 10 $input.empty();
11 $input.append(data); 11 $input.append(data);
12 }); 12 });
@@ -18,9 +18,9 @@ $(document).ready(function(){ @@ -18,9 +18,9 @@ $(document).ready(function(){
18 $(this).addClass('active_button'); 18 $(this).addClass('active_button');
19 $('#person').removeClass('active_button'); 19 $('#person').removeClass('active_button');
20 20
21 - $('#accountsform-company').attr('type', 'text').attr('placeholder', 'Компания').val('');  
22 - $('.field-accountsform-company').css('display','block');  
23 - $('#accountsform-is_firm').val('1'); 21 + $('#accounts-company').attr('type', 'text').attr('placeholder', 'Компания').val('');
  22 + $('.field-accounts-company').css('display','block');
  23 + $('#accounts-is_firm').val('1');
24 24
25 }); 25 });
26 26
@@ -28,9 +28,9 @@ $(document).ready(function(){ @@ -28,9 +28,9 @@ $(document).ready(function(){
28 $('#company').removeClass('active_button'); 28 $('#company').removeClass('active_button');
29 $(this).addClass('active_button'); 29 $(this).addClass('active_button');
30 30
31 - $('.field-accountsform-company').css('display','none');  
32 - $('#accountsform-company').attr('type', 'hidden').val('Частное лицо');  
33 - $('#accountsform-is_firm').val('0'); 31 + $('.field-accounts-company').css('display','none');
  32 + $('#accounts-company').attr('type', 'hidden').val('Частное лицо');
  33 + $('#accounts-is_firm').val('0');
34 34
35 35
36 }); 36 });
test.html 0 → 100644
  1 +yii\web\Cookie Object ( [name] => _frontendUser [value] => [1,"admin",2592000] [domain] => [expire] => 1451578203 [path] => / [secure] => [httpOnly] => 1 ) 1
  2 +yii\web\Cookie Object ( [name] => _frontendUser [value] => [4201,"wwww",2592000] [domain] => [expire] => 1451578282 [path] => / [secure] => [httpOnly] => 1 ) 1
0 \ No newline at end of file 3 \ No newline at end of file