Commit 5c9840b3148539f8f2d3ba8971a82eef55df2660

Authored by Mihail
2 parents ed1e700c 878c38e8

Merge branch 'master' of gitlab.artweb.com.ua:root/test_1

common/models/UserLoginForm.php
... ... @@ -3,7 +3,7 @@ namespace common\models;
3 3  
4 4 use Yii;
5 5 use yii\base\Model;
6   -
  6 +use yii\web\IdentityInterface;
7 7 /**
8 8 * Login form
9 9 */
... ... @@ -26,6 +26,8 @@ class UserLoginForm extends Model
26 26 [['email', 'pass'], 'required'],
27 27 // rememberMe must be a boolean value
28 28 ['rememberMe', 'boolean'],
  29 + // password is validated by validatePassword()
  30 + ['pass', 'validatePassword'],
29 31 ];
30 32 }
31 33  
... ... @@ -40,8 +42,8 @@ class UserLoginForm extends Model
40 42 {
41 43 if (!$this->hasErrors()) {
42 44 $user = $this->getUser();
43   - if (!$user || !$user->validatePassword($this->password)) {
44   - $this->addError($attribute, 'Incorrect email or password.');
  45 + if (!$user || $user->pass != $this->pass) {
  46 + $this->addError($attribute, 'Неправильный логин или пароль');
45 47 }
46 48 }
47 49 }
... ... @@ -59,6 +61,7 @@ class UserLoginForm extends Model
59 61 } else {
60 62 return false;
61 63 }
  64 +
62 65 }
63 66  
64 67 /**
... ...
frontend/controllers/SiteController.php
... ... @@ -15,6 +15,7 @@ use frontend\models\ContactForm;
15 15 use yii\base\InvalidParamException;
16 16 use yii\web\BadRequestHttpException;
17 17 use yii\web\Controller;
  18 +
18 19 use yii\filters\VerbFilter;
19 20 use yii\filters\AccessControl;
20 21 use common\models\Callback;
... ... @@ -365,14 +366,17 @@ class SiteController extends Controller
365 366 */
366 367 public function actionRequestPasswordReset()
367 368 {
  369 + $this->layout = '/internal';
  370 +
368 371 $model = new PasswordResetRequestForm();
369 372 if ($model->load(Yii::$app->request->post()) && $model->validate()) {
  373 +
370 374 if ($model->sendEmail()) {
371   - Yii::$app->session->setFlash('success', 'Check your email for further instructions.');
  375 + Yii::$app->session->setFlash('success', 'Для того, чтобы изменить пароль, перейдите по ссылке, которая придет Вам на email');
372 376  
373 377 return $this->goHome();
374 378 } else {
375   - Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for email provided.');
  379 + Yii::$app->session->setFlash('error', 'Пользователя с таким e-mail в базе не существует');
376 380 }
377 381 }
378 382  
... ...
frontend/models/PasswordResetRequestForm.php
1 1 <?php
2 2 namespace frontend\models;
3 3  
4   -use common\models\User;
  4 +use common\models\Accounts;
5 5 use yii\base\Model;
6   -
  6 +use common\models\Emails;
7 7 /**
8 8 * Password reset request form
9 9 */
... ... @@ -21,9 +21,8 @@ class PasswordResetRequestForm extends Model
21 21 ['email', 'required'],
22 22 ['email', 'email'],
23 23 ['email', 'exist',
24   - 'targetClass' => '\common\models\User',
25   - 'filter' => ['status' => User::STATUS_ACTIVE],
26   - 'message' => 'There is no user with such email.'
  24 + 'targetClass' => '\common\models\Accounts',
  25 + 'message' => 'Пользователя с таким e-mail в базе не существует.'
27 26 ],
28 27 ];
29 28 }
... ... @@ -35,23 +34,24 @@ class PasswordResetRequestForm extends Model
35 34 */
36 35 public function sendEmail()
37 36 {
38   - /* @var $user User */
39   - $user = User::findOne([
40   - 'status' => User::STATUS_ACTIVE,
  37 +
  38 + /* @var $user Accounts */
  39 + $user = Accounts::findOne([
41 40 'email' => $this->email,
42 41 ]);
43 42  
44 43 if ($user) {
45   - if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
  44 + if (!Accounts::isPasswordResetTokenValid($user->password_reset_token)) {
46 45 $user->generatePasswordResetToken();
47 46 }
48 47  
49 48 if ($user->save()) {
50   - return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])
51   - ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])
52   - ->setTo($this->email)
53   - ->setSubject('Password reset for ' . \Yii::$app->name)
54   - ->send();
  49 + $form = array();
  50 + $form ['email'] = $user->email;
  51 + $form ['name'] = $user->name;
  52 + $form ['pass'] = $user->pass;
  53 + return Emails::get('remide',$form,$form ['email']);
  54 +
55 55 }
56 56 }
57 57  
... ...
frontend/views/accounts/cabinet.php
... ... @@ -3,6 +3,7 @@ use \yii\widgets\ActiveForm;
3 3 use \yii\helpers\ArrayHelper;
4 4 use \common\models\DicCities;
5 5 use \common\models\Deliveries;
  6 +use \yii\helpers\Url;
6 7  
7 8 $this->registerCssFile('/css/about_company.css');
8 9 $this->registerCssFile('/css/style/notepad.css');
... ... @@ -17,16 +18,19 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
17 18 <div class="vin">
18 19 <p class="vin_article">Мой профиль</p>
19 20 <div class='side_menu'>
20   -<ul class="side_menu-list" role="tablist">
21   - <li class="active"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Личные данные</a></li>
22   - <li><a href="#notepad" aria-controls="notepad" role="tab" data-toggle="tab">Блокнот</a></li>
23   - <li><a href="#busket" aria-controls="busket" role="tab" data-toggle="tab">Корзина</a></li>
24   - <li><a href="#orders" aria-controls="orders" role="tab" data-toggle="tab">Заказы</a></li>
25   - <!-- <li><a href="#finance" aria-controls="finance" role="tab" data-toggle="tab">Финансы</a></li>
26   - <li><a href="history" aria-controls="history" role="tab" data-toggle="tab">История запросов</a></li>
27   - <li><a href="#avto" aria-controls="avto" role="tab" data-toggle="tab">Ваши авто</a></li>
28   - <li><a href="#message" aria-controls="message" role="tab" data-toggle="tab">Оставить сообщение<br>об оплате и возврате</a></li> -->
29   -</ul>
  21 + <?php
  22 + echo \yii\widgets\Menu::widget([
  23 + 'options' => ['class' => 'side_menu-list'],
  24 + 'items' => [
  25 + ['label' => 'Личные данные', 'url' => Url::toRoute(['/accounts/cabinet'])],
  26 + ['label' => 'Блокнот', 'url' => Url::toRoute(['/accounts/cabinet'])],
  27 + ['label' => 'Корзина', 'url' => Url::toRoute(['/accounts/cabinet'])],
  28 + ['label' => 'Заказы', 'url' => Url::toRoute(['/accounts/cabinet'])],
  29 + ['label' => 'Выйти', 'url' => Url::toRoute(['/site/logout'])],
  30 +
  31 + ],
  32 + ]);
  33 + ?>
30 34 <div class="tab-content">
31 35 <div role="tabpanel" class="tab-pane active" id="profile">
32 36 <p class="tab-content_header">Личные данные</p>
... ... @@ -35,7 +39,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
35 39  
36 40 <?php $form = ActiveForm::begin(['options' => ['enctype'=> 'multipart/form-data','class'=>'my_profile'], 'method'=>'post','action' => '/site/signup',]); ?>
37 41  
38   - <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0']) ?>
  42 + <?= $form->field($model, 'is_firm')->hiddenInput(['value'=>'0'])->label(false) ?>
39 43  
40 44 <?= $form->field($model, 'company')->hiddenInput(['value'=>'Частное лицо']) ?>
41 45  
... ... @@ -51,19 +55,19 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
51 55  
52 56 <?= $form->field($model, 're_pass',['options'=>['class'=>'input2']])->passwordInput(['maxlength' => 45,'placeholder'=>'Пароль','class'=>'form-control telephone_registration']) ?>
53 57  
54   - <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  58 + <?= $form->field($model, 'country',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList(
55 59 ArrayHelper::map(DicCities::find()->where(['parent' => 0])->all(), 'id', 'name'),
56 60 ['prompt' => 'Выберите область']
57 61 );
58 62 ?>
59 63  
60   - <?= $form->field($model, 'city',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  64 + <?= $form->field($model, 'city',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList(
61 65 [],
62 66 ['prompt' => 'Выберите город']
63 67 );
64 68 ?>
65 69  
66   - <?= $form->field($model, 'deliveries',['options'=>['class'=>'selectize_item2' ]])->dropDownList(
  70 + <?= $form->field($model, 'deliveries',['options'=>['class'=>'selectize_item2 input2' ]])->dropDownList(
67 71 ArrayHelper::map(Deliveries::find()->all(), 'id', 'name'),
68 72 ['prompt' => 'Выберите тип перевозки']
69 73 );
... ... @@ -79,7 +83,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
79 83 </div>
80 84  
81 85  
82   -</div>
  86 +
83 87 </div>
84 88 <div role="tabpanel" class="tab-pane" id="notepad">
85 89 <p class="tab-content_header">Блокнот</p>
... ... @@ -249,85 +253,6 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
249 253 </div>
250 254  
251 255  
252   -<div class="slider_block1">
253   - <div class="tovars">
254   - <p style="display:inline-block">Наши проекты</p>
255   - <span><img src="/images/arrow_slider_back.png"></span>
256   - <span class="number_of">1/</span>
257   - <span class="general_number">5</span>
258   - <span><img src="/images/arrow_slider_go.png"></span>
259   - <div class="slider_tovars">
260   -
261   - <table class="block_project">
262   - <tbody><tr><td>
263   - <img src="/images/logo-lr-small.png">
264   - </td></tr>
265   - <tr><td>
266   - <a href="">lr.italauto.com.ua</a>
267   - </td></tr>
268   - <tr><td>
269   - <ul>
270   - <h4>Запчасти на Land Rover<br> и Range Rover</h4>
271   - <li>Оригинальные запчасти</li>
272   - <li>Сертифицированый продавец</li>
273   - <li>Более 300 000 товаров</li>
274   - </ul>
275   - </td></tr>
276   - </tbody></table>
277   - <table class="block_project">
278   - <tbody><tr><td>
279   - <img src="/images/logo-mersedes-small.png">
280   - </td></tr>
281   - <tr><td>
282   - <a href="">lr.italauto.com.ua</a>
283   - </td></tr>
284   - <tr><td>
285   - <ul>
286   - <h4>Запчасти на<br> Mercedes Benz</h4>
287   - <li>Оригинальные запчасти</li>
288   - <li>Сертифицированый продавец</li>
289   - <li>Более 300 000 товаров</li>
290   - </ul>
291   - </td></tr>
292   - </tbody></table>
293   - <table class="block_project">
294   - <tbody><tr><td>
295   - <img src="/images/logo-fiat-small.png">
296   - </td></tr>
297   - <tr><td>
298   - <a href="">lr.italauto.com.ua</a>
299   - </td></tr>
300   - <tr><td>
301   - <ul>
302   - <h4>Запчасти на FIAT</h4>
303   - <li>Оригинальные запчасти</li>
304   - <li>Сертифицированый продавец</li>
305   - <li>Более 300 000 товаров</li>
306   - </ul>
307   - </td></tr>
308   - </tbody></table>
309   - <table class="block_project">
310   - <tbody><tr><td>
311   - <img src="/images/logo-lr-small.png">
312   - </td></tr>
313   - <tr><td>
314   - <a href="">lr.italauto.com.ua</a>
315   - </td></tr>
316   - <tr><td>
317   - <ul>
318   - <h4>Запчасти на Land Rover<br> и Range Rover</h4>
319   - <li>Оригинальные запчасти</li>
320   - <li>Сертифицированый продавец</li>
321   - <li>Более 300 000 товаров</li>
322   - </ul>
323   - </td></tr>
324   - </tbody></table>
325   -
326   - </div>
327   -
328   - </div>
329   - </div>
330   -
331 256  
332 257  
333 258 <script>
... ...
frontend/views/page/about_view.php
1 1 <?php
2   -$this->registerCssFile('/css/about_company.css');
3 2 use \yii\helpers\Url;
  3 +$this->registerCssFile('/css/about_company.css');
  4 +$this->registerCssFile('/css/style/optovikam.css');
  5 +
4 6 $this->registerMetaTag(['description' => $model->descr,'keywords'=>$model->kwords]);
5 7 $this->title = $model->title ? $model->title: $model->name;
6 8 $this->params['breadcrumbs'][] = $this->title;
... ...
frontend/views/page/view.php
1 1 <?php
2 2 $this->registerCssFile('/css/about_company.css');
  3 +$this->registerCssFile('/css/style/optovikam.css');
3 4 $this->registerMetaTag(['description' => $model->descr,'keywords'=>$model->kwords]);
4 5 $this->title = $model->title ? $model->title: $model->name;
5 6 $this->params['breadcrumbs'][] = $this->title;
6   -
7 7 ?>
8 8 <div class="main-vin">
9 9  
... ...
frontend/views/site/login.php
... ... @@ -10,13 +10,13 @@ use yii\captcha\Captcha;
10 10  
11 11  
12 12 ?>
13   -<div id="modal_form_registration" >
  13 +<div id="form_login" >
14 14 <?php $form = ActiveForm::begin(['id' => 'enter_form','class'=>'cmxform','action' => '/site/login']); ?>
15 15 <fieldset>
16 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() ?>
  17 + <?= $form->field($model, 'email')->label(false) ?>
  18 + <?= $form->field($model, 'pass')->passwordInput()->label(false) ?>
  19 + <?= $form->field($model, 'rememberMe')->checkbox() ?>
20 20 <?= Html::a('Забыли пароль?', ['site/request-password-reset']) ?>
21 21 <?= Html::submitButton('Submit', ['class' => 'purple', 'name' => 'login-button']) ?>
22 22 </fieldset>
... ...
frontend/views/site/requestPasswordResetToken.php 0 → 100755
  1 +<?php
  2 +use yii\helpers\Html;
  3 +use yii\bootstrap\ActiveForm;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $form yii\bootstrap\ActiveForm */
  7 +/* @var $model \frontend\models\PasswordResetRequestForm */
  8 +
  9 +$this->title = 'Запрос на востановление пароля';
  10 +$this->params['breadcrumbs'][] = $this->title;
  11 +?>
  12 +<div class="main-vin">
  13 + <h1><?= Html::encode($this->title) ?></h1>
  14 +
  15 + <p>Введите ваш e-mail</p>
  16 +
  17 + <div class="row">
  18 + <div class="col-lg-5">
  19 + <?php $form = ActiveForm::begin(['id' => 'request-password-reset-form']); ?>
  20 + <?= $form->field($model, 'email')->label(false) ?>
  21 + <div class="form-group">
  22 + <?= Html::submitButton('Отправить', ['class' => 'btn btn-primary']) ?>
  23 + </div>
  24 + <?php ActiveForm::end(); ?>
  25 + </div>
  26 + </div>
  27 +</div>
... ...
frontend/web/css/main.css
... ... @@ -264,6 +264,204 @@ div.required:after { content: &quot; *&quot;;
264 264 background-position: 100% 46%;
265 265 }
266 266  
  267 +#messages .telephone p{
  268 + font-size: 24px!important;
  269 +}
  270 +#messages .telephone img{
  271 + position: relative;
  272 + top: -4px;
  273 +}
  274 +#messages .first_block :nth-child(2){
  275 + font-size: 14px;
  276 +}
  277 +#messages .first_block p:first-child{
  278 + display: block;
  279 + font-size: 19px!important;
  280 + margin-bottom: 14px;
  281 +}
  282 +
  283 +#messages .telephone{
  284 + margin-top: 11px;
  285 + margin-bottom: 3px;
  286 +}
  287 +
  288 +#messages .work_hours p:first-child{
  289 + font-size: 19px;
  290 +}
  291 +
  292 +#messages .block_contacts p:first-child{
  293 + font-size: 19px;
  294 +}
  295 +
  296 +#messages .block_contacts a{
  297 + color: #333333;
  298 + display: inline-block;
  299 + margin-bottom: 3px;
  300 +}
  301 +
  302 +#messages iframe {
  303 + width: 960px;
  304 + margin-bottom: 33px;
  305 +}
  306 +
  307 +#enter_form div.required:after{
  308 + left: 100px;
  309 +}
  310 +
  311 +#modal_form{
  312 + border-bottom: none!important;
  313 +}
  314 +
  315 +.own_page3{
  316 + border-bottom: 4px solid #dfdfdf;
  317 +}
  318 +
  319 +#enter_form a{
  320 + margin-left: 80px;
  321 + color: #6b84b5;
  322 + text-decoration: underline;
  323 + position: relative;
  324 + top: -18px;
  325 +}
  326 +
  327 +#modal_form input[type="checkbox"], #form_login input[type="checkbox"]{
  328 + display: inline-block!important;
  329 + width: 16px;
  330 + height: 16px;
  331 + margin-bottom: 16px;
  332 + background: url('/images/checkbox.png') no-repeat;
  333 + cursor: pointer;
  334 + padding: 0;
  335 + margin: 0 0 16px 0;
  336 + position: absolute;
  337 + left: -20px;
  338 + top: 0;
  339 + -webkit-transition: background 0.4s linear;
  340 + -o-transition: background 0.4s linear;
  341 + -moz-transition: background 0.4s linear;
  342 + transition: background 0.4s linear;
  343 +}
  344 +
  345 +#modal_form input[type="checkbox"]:checked + label span {
  346 + background: url('/images/input-type-checked.png') no-repeat;
  347 +}
  348 +
  349 +.form-group{
  350 + margin-bottom: 0;
  351 +}
  352 +
  353 +.field-userloginform-rememberme{
  354 + display: inline-block;
  355 + margin-left: 132px;
  356 + position: relative;
  357 + top: -17px;
  358 +}
  359 +
  360 +.field-userloginform-rememberme label{
  361 + color: #6b84b5;
  362 + text-decoration: underline;
  363 + font-weight: 500;
  364 +}
  365 +
  366 +#modal_form .purple {
  367 + display: table;
  368 + margin: -6px auto 36px!important;
  369 +}
  370 +
  371 +#modal_form .field-userloginform-email{
  372 + position: relative;
  373 +}
  374 +
  375 +#modal_form .field-userloginform-email .help-block{
  376 + top: 28px;
  377 + left: 115px!important;
  378 +}
  379 +
  380 +#modal_form .field-userloginform-pass{
  381 + margin-top: -10px;
  382 + margin-bottom: 12px;
  383 + position: relative;
  384 +}
  385 +#modal_form .purple{
  386 + display: table;
  387 + margin: -6px auto 34px;
  388 +}
  389 +#modal_form .field-userloginform-pass .help-block{
  390 + top: 26px;
  391 + left: 114px!important;
  392 +}
  393 +
  394 +.main_search{
  395 + width: 434px!important;
  396 +}
  397 +
267 398 .field-accounts-company{
268 399 display: none;
  400 +}
  401 +
  402 +
  403 +#form_login{
  404 + margin: 0 auto;
  405 + width: 561px;
  406 + position: relative;
  407 +}
  408 +#form_login input {
  409 + background-color: #f5f5f5;
  410 + width: 334px;
  411 + height: 30px;
  412 + padding-left: 9px;
  413 + border-radius: 6px;
  414 + border: 1px solid #dfdfdf;
  415 + margin: 0 auto;
  416 +}
  417 +
  418 +#form_login h3{
  419 + text-align: center;
  420 + margin-bottom: 29px;
  421 +}
  422 +
  423 +#userloginform-rememberme{
  424 +
  425 +}
  426 +
  427 +#form_login .purple{
  428 + display: table;
  429 + margin: 0 auto;
  430 +}
  431 +
  432 +#form_login .field-userloginform-pass{
  433 + margin-bottom: 24px;
  434 +}
  435 +#form_login .field-userloginform-pass:after{
  436 + top: -21px;
  437 +}
  438 +
  439 +
  440 +#modal_form_call div.required:after{
  441 + left: 101px;
  442 +}
  443 +
  444 +.input2 label{
  445 + top: 8px
  446 +}
  447 +
  448 +.my_profile div.required:after{
  449 + top: -34px;
  450 + left: 104px;
  451 +}
  452 +.my_profile .selectize_item2 {
  453 + background: url("/images/arrow-cart-down.png") no-repeat 100% 61%;
  454 +}
  455 +.form-control{
  456 + padding-top: 3px;
  457 +}
  458 +
  459 +.my_profile .selectize_item2{
  460 + display: inherit;
  461 + margin: 0px 13px 21px 65px!important;
  462 + width: 371px;
  463 +}
  464 +
  465 +.my_profile .selectize_item2 label{
  466 + left: -65px;
269 467 }
270 468 \ No newline at end of file
... ...
frontend/web/js/script.js
... ... @@ -26,6 +26,7 @@ $(&#39;.phone_control, .phone_placeholder&#39;).click(
26 26  
27 27 }
28 28 )
  29 +
29 30 $('.kyiv').click(
30 31 function(){
31 32 $('.phone_select').empty();
... ... @@ -615,7 +616,7 @@ $(window).scroll(function()
615 616 $('.purple_menu1').css({'position':'fixed', 'top':'0'});
616 617 $('.purple_menu1').addClass('purple_shadow');
617 618 $('.menu_block_center1').css({display:'none'});
618   - $('.main_search').animate({'width':'434px'}, 1000)
  619 + //$('.main_search').animate({'width':'434px'}, 1000)
619 620 $('.dropdown_menu').addClass('active_menu');
620 621 $('.menu_block_center2 .dropdown_menu').css({'left':'-447px'});
621 622  
... ...