Commit 13ad65b4a47ae585ee0aca32ce26057de4e762a1

Authored by alex
1 parent 5df25c5c

Правка футера 2

common/models/Feedback.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +
  6 +use artbox\core\models\Feedback as CoreFeedback;
  7 +
  8 +
  9 +class FeedBack extends CoreFeedback
  10 +{
  11 +
  12 + public $reCaptcha;
  13 +
  14 + public function rules()
  15 + {
  16 + return [
  17 + [
  18 + [
  19 + 'name',
  20 + 'email',
  21 + 'phone',
  22 + ],
  23 + 'required',
  24 + 'on' => self::SCENARIO_DEFAULT,
  25 + ],
  26 + [[
  27 + 'reCaptcha'
  28 + ],
  29 + \himiklab\yii2\recaptcha\ReCaptchaValidator::className(),
  30 + 'secret' => '6LcmYmcUAAAAACVi_73RmSAIjJlw4BCgQpfUsrPs',
  31 + 'uncheckedMessage' => 'Please confirm that you are not a bot.',
  32 + 'on' => self::SCENARIO_DEFAULT,
  33 + ],
  34 + [
  35 + [
  36 + 'name',
  37 + 'email',
  38 + ],
  39 + 'required',
  40 + 'on' => self::SCENARIO_FEEDBACK,
  41 + ],
  42 + [
  43 + [
  44 + 'phone',
  45 + 'name',
  46 + ],
  47 + 'required',
  48 + 'on' => self::SCENARIO_CALLBACK,
  49 + ],
  50 + [
  51 + ['email'],
  52 + 'email',
  53 + ],
  54 + // [
  55 + // [ 'phone' ],
  56 + // 'match',
  57 + // 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/',
  58 + // ],
  59 + [
  60 + [
  61 + 'name',
  62 + 'phone',
  63 + 'email',
  64 + ],
  65 + 'string',
  66 + 'max' => 255,
  67 + ],
  68 + [
  69 + [
  70 + 'message',
  71 + ],
  72 + 'string',
  73 + ],
  74 + [
  75 + [
  76 + 'status',
  77 + ],
  78 + 'boolean',
  79 + ],
  80 + [
  81 + 'returnUrl',
  82 + 'safe',
  83 + ],
  84 + ];
  85 + }
  86 +
  87 +}
  88 +
  89 +
  90 +?>
0 91 \ No newline at end of file
... ...
composer.json
... ... @@ -38,7 +38,8 @@
38 38 "kartik-v/yii2-widget-datepicker": "@dev",
39 39 "yiisoft/yii2-jui": "^2.0",
40 40 "skeeks/yii2-assets-auto-compress": "*",
41   - "zyx/zyx-phpmailer": "@stable"
  41 + "zyx/zyx-phpmailer": "@stable",
  42 + "himiklab/yii2-recaptcha-widget": "*"
42 43 },
43 44 "require-dev": {
44 45 "yiisoft/yii2-debug": "~2.0.0",
... ...
composer.lock
... ... @@ -4,7 +4,8 @@
4 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5 "This file is @generated automatically"
6 6 ],
7   - "content-hash": "327786678167aec639aac10434a84c27",
  7 + "hash": "2f688f9614eac03da72eef7df04c6d22",
  8 + "content-hash": "3a33f40efa994f6a041392840080911f",
8 9 "packages": [
9 10 {
10 11 "name": "2amigos/yii2-tinymce-widget",
... ... @@ -1090,6 +1091,50 @@
1090 1091 "time": "2017-03-20 17:10:46"
1091 1092 },
1092 1093 {
  1094 + "name": "himiklab/yii2-recaptcha-widget",
  1095 + "version": "1.2.1",
  1096 + "source": {
  1097 + "type": "git",
  1098 + "url": "https://github.com/himiklab/yii2-recaptcha-widget.git",
  1099 + "reference": "cc8a023bf51db3b40f1b8532cd94fc00c532edf5"
  1100 + },
  1101 + "dist": {
  1102 + "type": "zip",
  1103 + "url": "https://api.github.com/repos/himiklab/yii2-recaptcha-widget/zipball/cc8a023bf51db3b40f1b8532cd94fc00c532edf5",
  1104 + "reference": "cc8a023bf51db3b40f1b8532cd94fc00c532edf5",
  1105 + "shasum": ""
  1106 + },
  1107 + "require": {
  1108 + "yiisoft/yii2": "~2.0.11",
  1109 + "yiisoft/yii2-httpclient": "*"
  1110 + },
  1111 + "type": "yii2-extension",
  1112 + "autoload": {
  1113 + "psr-4": {
  1114 + "himiklab\\yii2\\recaptcha\\": ""
  1115 + }
  1116 + },
  1117 + "notification-url": "https://packagist.org/downloads/",
  1118 + "license": [
  1119 + "MIT"
  1120 + ],
  1121 + "authors": [
  1122 + {
  1123 + "name": "HimikLab",
  1124 + "homepage": "https://github.com/himiklab/"
  1125 + }
  1126 + ],
  1127 + "description": "Yii2 Google reCAPTCHA widget",
  1128 + "keywords": [
  1129 + "captcha",
  1130 + "google",
  1131 + "recaptcha",
  1132 + "widget",
  1133 + "yii2"
  1134 + ],
  1135 + "time": "2018-07-03 13:34:52"
  1136 + },
  1137 + {
1093 1138 "name": "hiqdev/yii2-asset-icheck",
1094 1139 "version": "1.0.2.5",
1095 1140 "source": {
... ... @@ -1491,7 +1536,7 @@
1491 1536 },
1492 1537 "dist": {
1493 1538 "type": "zip",
1494   - "url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/9110ecce9deb59dc116fe6c3dd6df5d7eb439a3c",
  1539 + "url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/39e0e71277d0f115341e118a2b879a0dfcbd01c3",
1495 1540 "reference": "9110ecce9deb59dc116fe6c3dd6df5d7eb439a3c",
1496 1541 "shasum": ""
1497 1542 },
... ... @@ -1600,7 +1645,7 @@
1600 1645 },
1601 1646 "dist": {
1602 1647 "type": "zip",
1603   - "url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/690ddac32f6796f63b8317783f26e89ca26fa94a",
  1648 + "url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/d08a5b302fe04216bd04290f0e99e26386801a37",
1604 1649 "reference": "690ddac32f6796f63b8317783f26e89ca26fa94a",
1605 1650 "shasum": ""
1606 1651 },
... ... @@ -2080,7 +2125,7 @@
2080 2125 }
2081 2126 ],
2082 2127 "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
2083   - "time": "2014-05-14T07:04:18+00:00"
  2128 + "time": "2014-05-14 07:04:18"
2084 2129 },
2085 2130 {
2086 2131 "name": "phpoffice/phpexcel",
... ... @@ -3062,6 +3107,53 @@
3062 3107 "time": "2016-12-20 13:26:02"
3063 3108 },
3064 3109 {
  3110 + "name": "yiisoft/yii2-httpclient",
  3111 + "version": "2.0.4",
  3112 + "source": {
  3113 + "type": "git",
  3114 + "url": "https://github.com/yiisoft/yii2-httpclient.git",
  3115 + "reference": "720e3c9bdda260abffe61babfe39b91c4308ac4c"
  3116 + },
  3117 + "dist": {
  3118 + "type": "zip",
  3119 + "url": "https://api.github.com/repos/yiisoft/yii2-httpclient/zipball/720e3c9bdda260abffe61babfe39b91c4308ac4c",
  3120 + "reference": "720e3c9bdda260abffe61babfe39b91c4308ac4c",
  3121 + "shasum": ""
  3122 + },
  3123 + "require": {
  3124 + "yiisoft/yii2": "~2.0.0"
  3125 + },
  3126 + "type": "yii2-extension",
  3127 + "extra": {
  3128 + "branch-alias": {
  3129 + "dev-master": "2.0.x-dev"
  3130 + }
  3131 + },
  3132 + "autoload": {
  3133 + "psr-4": {
  3134 + "yii\\httpclient\\": ""
  3135 + }
  3136 + },
  3137 + "notification-url": "https://packagist.org/downloads/",
  3138 + "license": [
  3139 + "BSD-3-Clause"
  3140 + ],
  3141 + "authors": [
  3142 + {
  3143 + "name": "Paul Klimov",
  3144 + "email": "klimov.paul@gmail.com"
  3145 + }
  3146 + ],
  3147 + "description": "HTTP client extension for the Yii framework",
  3148 + "keywords": [
  3149 + "curl",
  3150 + "http",
  3151 + "httpclient",
  3152 + "yii2"
  3153 + ],
  3154 + "time": "2017-06-23 09:36:13"
  3155 + },
  3156 + {
3065 3157 "name": "yiisoft/yii2-imagine",
3066 3158 "version": "2.1.0",
3067 3159 "source": {
... ... @@ -3265,7 +3357,7 @@
3265 3357 "theme",
3266 3358 "yii2"
3267 3359 ],
3268   - "time": "2017-05-22T11:24:30+00:00"
  3360 + "time": "2017-05-22 11:24:30"
3269 3361 },
3270 3362 {
3271 3363 "name": "zyx/zyx-phpmailer",
... ... @@ -3309,7 +3401,7 @@
3309 3401 "phpmailer",
3310 3402 "yii2"
3311 3403 ],
3312   - "time": "2014-05-14T20:30:24+00:00"
  3404 + "time": "2014-05-14 20:30:24"
3313 3405 }
3314 3406 ],
3315 3407 "packages-dev": [
... ...
frontend/config/main.php
... ... @@ -28,6 +28,12 @@
28 28 'csrfParam' => '_csrf-frontend',
29 29 'baseUrl' => '/',
30 30 ],
  31 + 'reCaptcha' => [
  32 + 'name' => 'reCaptcha',
  33 + 'class' => 'himiklab\yii2\recaptcha\ReCaptcha',
  34 + 'siteKey' => '6LcmYmcUAAAAAASKWf3qnHXJCg9vGfJfDefY9TzW',
  35 + 'secret' => '6LcmYmcUAAAAACVi_73RmSAIjJlw4BCgQpfUsrPs',
  36 + ],
31 37 'user' => [
32 38 'identityClass' => 'artbox\order\models\Customer',
33 39 'enableAutoLogin' => true,
... ...
frontend/views/site/contact.php
... ... @@ -11,6 +11,7 @@
11 11 use yii\helpers\Html;
12 12 use yii\bootstrap\ActiveForm;
13 13 use yii\web\View;
  14 +use himiklab\yii2\recaptcha\ReCaptcha;
14 15  
15 16 MapAsset::register($this);
16 17 $settings = Settings::getInstance();
... ... @@ -168,7 +169,10 @@ JS;
168 169 ]
169 170 ); ?>
170 171 </div>
171   -
  172 + <?= $form->field($contact, 'reCaptcha')->widget(
  173 + \himiklab\yii2\recaptcha\ReCaptcha::className(),
  174 + ['siteKey' => '6LcmYmcUAAAAAASKWf3qnHXJCg9vGfJfDefY9TzW']
  175 + ) ?>
172 176 <div class="col-sm-12 text-center">
173 177 <?= Html::submitButton(
174 178 '<i class="fa fa-envelope-o"></i> Отправить сообщение',
... ...