diff --git a/.env-dist b/.env-dist index f2d53d9..b7a3d51 100644 --- a/.env-dist +++ b/.env-dist @@ -18,9 +18,11 @@ RECAPTCHA_SECRET= SENTRY_DSN= ## SMTP params +SMTP_HOST= +SMTP_PORT= SMTP_USER= SMTP_PASS= -SMTP_PORT= +SMTP_ENCRYPTION= ## MariaDB connection params DB_HOST=db diff --git a/api/models/FeedbackForm.php b/api/models/FeedbackForm.php index 6e5730c..5420cb5 100644 --- a/api/models/FeedbackForm.php +++ b/api/models/FeedbackForm.php @@ -1,11 +1,13 @@ E::SUBJECT_REQUIRED], - ['email', 'required', 'message' => E::EMAIL_REQUIRED], - ['message', 'required', 'message' => E::MESSAGE_REQUIRED], + [['subject'], 'required', 'message' => E::SUBJECT_REQUIRED], + [['email'], 'required', 'message' => E::EMAIL_REQUIRED], + [['message'], 'required', 'message' => E::MESSAGE_REQUIRED], [['subject'], 'string', 'max' => 255], [['email'], 'email', 'message' => E::EMAIL_INVALID], [['message'], 'string', 'max' => 65535], @@ -52,9 +54,7 @@ class FeedbackForm extends ApiForm { ->setFrom([$this->email => $account ? $account->username : $this->email]) ->setSubject($this->subject); - if (!$message->send()) { - throw new ErrorException('Unable send feedback email.'); - } + Assert::true($message->send(), 'Unable send feedback email.'); return true; } diff --git a/common/config/config.php b/common/config/config.php index 8b7e707..a784702 100644 --- a/common/config/config.php +++ b/common/config/config.php @@ -54,17 +54,11 @@ return [ 'viewPath' => '@common/mail', 'transport' => [ 'class' => Swift_SmtpTransport::class, - 'host' => 'ely.by', + 'host' => getenv('SMTP_HOST'), 'username' => getenv('SMTP_USER'), 'password' => getenv('SMTP_PASS'), 'port' => getenv('SMTP_PORT') ?: 587, - 'encryption' => 'tls', - 'streamOptions' => [ - 'ssl' => [ - 'allow_self_signed' => true, - 'verify_peer' => false, - ], - ], + 'encryption' => getenv('SMTP_ENCRYPTION') ?: 'tls', ], ], 'sentry' => [ diff --git a/composer.lock b/composer.lock index 0d6dc34..0015654 100644 --- a/composer.lock +++ b/composer.lock @@ -173,7 +173,7 @@ "version": "3.27.0", "source": { "type": "git", - "url": "https://github.com/getsentry/raven-js-bower.git", + "url": "git@github.com:getsentry/raven-js-bower.git", "reference": "c8b3a6040be6928e2f57fa5eec4d7afc31750235" }, "dist": { @@ -520,30 +520,35 @@ }, { "name": "doctrine/lexer", - "version": "v1.0.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", + "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^7.2" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } }, "notification-url": "https://packagist.org/downloads/", @@ -551,26 +556,29 @@ "MIT" ], "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, { "name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com" }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com" } ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", "keywords": [ + "annotations", + "docblock", "lexer", - "parser" + "parser", + "php" ], - "time": "2014-09-09T13:34:57+00:00" + "time": "2019-10-30T14:39:59+00:00" }, { "name": "domnikl/statsd", @@ -624,16 +632,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.7", + "version": "2.1.12", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e" + "reference": "a6255605af39f2db7f5cb62e672bd8a7bad8d208" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e", - "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/a6255605af39f2db7f5cb62e672bd8a7bad8d208", + "reference": "a6255605af39f2db7f5cb62e672bd8a7bad8d208", "shasum": "" }, "require": { @@ -643,7 +651,8 @@ "require-dev": { "dominicsayers/isemail": "dev-master", "phpunit/phpunit": "^4.8.35||^5.7||^6.0", - "satooshi/php-coveralls": "^1.0.1" + "satooshi/php-coveralls": "^1.0.1", + "symfony/phpunit-bridge": "^4.4@dev" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -651,7 +660,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -677,7 +686,7 @@ "validation", "validator" ], - "time": "2018-12-04T22:38:24+00:00" + "time": "2019-12-20T12:49:39+00:00" }, { "name": "ely/mojang-api", @@ -4776,12 +4785,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "a115a278b47739a2f43a42fe8dc657948f256113" + "reference": "44a677c8e06241a66409ae6e4820dc166fc09ab2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/a115a278b47739a2f43a42fe8dc657948f256113", - "reference": "a115a278b47739a2f43a42fe8dc657948f256113", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/44a677c8e06241a66409ae6e4820dc166fc09ab2", + "reference": "44a677c8e06241a66409ae6e4820dc166fc09ab2", "shasum": "" }, "conflict": { @@ -4816,8 +4825,8 @@ "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.67|>=8,<8.6.16|>=8.7,<8.7.1|>8.7.3,<8.7.5", - "drupal/drupal": ">=7,<7.67|>=8,<8.6.16|>=8.7,<8.7.1|>8.7.3,<8.7.5", + "drupal/core": ">=7,<8.7.11|>=8.8,<8.8.1", + "drupal/drupal": ">=7,<8.7.11|>=8.8,<8.8.1", "erusev/parsedown": "<1.7.2", "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.4", "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.13.1|>=6,<6.7.9.1|>=6.8,<6.13.5.1|>=7,<7.2.4.1|>=7.3,<7.3.2.1", @@ -4872,7 +4881,7 @@ "pusher/pusher-php-server": "<2.2.1", "robrichards/xmlseclibs": ">=1,<3.0.4", "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", - "scheb/two-factor-bundle": "<3.26|>=4,<4.11", + "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", "shopware/shopware": "<5.3.7", @@ -4987,7 +4996,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2019-12-20T16:49:07+00:00" + "time": "2019-12-26T14:16:40+00:00" }, { "name": "sebastian/code-unit-reverse-lookup",