From 4af58f43c3a9fc698b1754ed9105c4b5531e9dfe Mon Sep 17 00:00:00 2001 From: Evg Date: Fri, 18 Aug 2023 04:19:45 +0300 Subject: [PATCH] =?UTF-8?q?ADD:=20=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D1=81=20API=20stopforumspam.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Languages/ar/msg.php | 1 + app/Languages/en/msg.php | 1 + app/Languages/ro/msg.php | 1 + app/Languages/ru/msg.php | 1 + app/Languages/ua/msg.php | 1 + app/Languages/zh_CN/msg.php | 1 + app/Languages/zh_TW/msg.php | 1 + app/Services/Сheck/EmailSpam.php | 27 +++++++++++++++++++++++++++ app/Validate/RulesRegistration.php | 5 +++++ composer.json | 3 ++- config/integration.php | 7 +++++-- 11 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 app/Services/Сheck/EmailSpam.php diff --git a/app/Languages/ar/msg.php b/app/Languages/ar/msg.php index 314e8942..fcd1b3a3 100644 --- a/app/Languages/ar/msg.php +++ b/app/Languages/ar/msg.php @@ -47,6 +47,7 @@ return [ 'code_incorrect' => 'الكود غير صحيح او تم استخدامه مسبقاً', 'yes_email_pass' => 'الان يمكنك استخدام بريدك الالكتروني و كلمةالسر.', 'email_replay' => 'البريد الالكتروني هذا مستخدم بالفعل في هذا الموقع.', + 'email_forbidden' => 'التسجيل مع البريد الإلكتروني المحدد ممنوع', 'multiple_accounts' => 'لا تقم بتسجيل عدة حسابات', 'five_width' => 'عرض الغلاف اقل 500px', 'five_format' => 'نوع الملف خاطئ', diff --git a/app/Languages/en/msg.php b/app/Languages/en/msg.php index 8af16af0..e146454a 100644 --- a/app/Languages/en/msg.php +++ b/app/Languages/en/msg.php @@ -47,6 +47,7 @@ return [ 'code_incorrect' => 'The code is incorrect or has already been used', 'yes_email_pass' => 'Now you can use your email and password.', 'email_replay' => 'This email is already on the site', + 'email_forbidden' => 'Registration with the specified e-mail is forbidden', 'multiple_accounts' => 'Do not register multiple accounts', 'five_width' => 'Cover width less than 500px', 'five_format' => 'Wrong file type', diff --git a/app/Languages/ro/msg.php b/app/Languages/ro/msg.php index 464ea072..f3b14919 100644 --- a/app/Languages/ro/msg.php +++ b/app/Languages/ro/msg.php @@ -47,6 +47,7 @@ return [ 'code_incorrect' => 'Codul este incorect sau a fost deja folosit', 'yes_email_pass' => 'Acum vă puteți folosi adresa de e-mail și parola.', 'email_replay' => 'Acest e-mail este deja pe site', + 'email_forbidden' => 'Înregistrarea la adresa de e-mail specificată este interzisă', 'multiple_accounts' => 'Nu înregistrați mai multe conturi', 'five_width' => 'Lățimea copertei mai mică de 500 px', 'five_format' => 'Tip de fișier greșit', diff --git a/app/Languages/ru/msg.php b/app/Languages/ru/msg.php index f8cd344d..512738dc 100644 --- a/app/Languages/ru/msg.php +++ b/app/Languages/ru/msg.php @@ -47,6 +47,7 @@ return [ 'code_incorrect' => 'Код неверен, или он уже использовался', 'yes_email_pass' => 'Теперь вы можете использовать свой e-mail и пароль.', 'email_replay' => 'Такой e-mail уже есть на сайте', + 'email_forbidden' => 'Запрещена регистрация с указанным e-mail', 'multiple_accounts' => 'Не регистрируйте множественные аккаунты', 'five_width' => 'Ширина обложки меньше 500px', 'five_format' => 'Неверный тип файла', diff --git a/app/Languages/ua/msg.php b/app/Languages/ua/msg.php index cb2527c0..8b639a76 100644 --- a/app/Languages/ua/msg.php +++ b/app/Languages/ua/msg.php @@ -47,6 +47,7 @@ return [ 'code_incorrect' => 'Код неправильний, або він уже використовувався', 'yes_email_pass' => 'Тепер ви можете використовувати свій e-mail та пароль.', 'email_replay' => 'Такий e-mail вже є на сайті', + 'email_forbidden' => 'Заборонено реєстрацію із зазначеним e-mail', 'multiple_accounts' => 'Не реєструйте численні облікові записи', 'five_width' => 'Ширина обкладинки менше 500px', 'five_format' => 'Невірний тип файлу', diff --git a/app/Languages/zh_CN/msg.php b/app/Languages/zh_CN/msg.php index f35a8b9e..4c8ae779 100644 --- a/app/Languages/zh_CN/msg.php +++ b/app/Languages/zh_CN/msg.php @@ -47,6 +47,7 @@ return [ 'code_incorrect' => '代码不正确或已被使用', 'yes_email_pass' => '现在你可以使用你的邮箱和密码了', 'email_replay' => '此邮箱已在网站上注册', + 'email_forbidden' => '禁止使用指定郵箱註冊', 'multiple_accounts' => '不要注册多个帐户', 'five_width' => '封面宽度小于500px', 'five_format' => '文件类型错误', diff --git a/app/Languages/zh_TW/msg.php b/app/Languages/zh_TW/msg.php index 99c7839c..23f7874d 100644 --- a/app/Languages/zh_TW/msg.php +++ b/app/Languages/zh_TW/msg.php @@ -47,6 +47,7 @@ return [ 'code_incorrect' => '代碼不正確或已被使用', 'yes_email_pass' => '現在您可以使用您的電子郵件和密碼了。', 'email_replay' => '此電子郵件已在網站上', + 'email_forbidden' => '禁止使用指定郵箱註冊', 'multiple_accounts' => '不要註冊多個帳戶', 'five_width' => '封面寬度小於 500px', 'five_format' => '文件类型错误', diff --git a/app/Services/Сheck/EmailSpam.php b/app/Services/Сheck/EmailSpam.php new file mode 100644 index 00000000..68c1efca --- /dev/null +++ b/app/Services/Сheck/EmailSpam.php @@ -0,0 +1,27 @@ +addEmail($email); + + $request = new Request(); + $response = $request->send($query); + $item = $response->getFlowingEmail(); + + return $item->isAppears(); + } +} diff --git a/app/Validate/RulesRegistration.php b/app/Validate/RulesRegistration.php index 62c8cc40..6913c85d 100644 --- a/app/Validate/RulesRegistration.php +++ b/app/Validate/RulesRegistration.php @@ -3,6 +3,7 @@ namespace App\Validate; use App\Models\AuthModel; +use App\Services\Сheck\EmailSpam; use App\Services\Integration\Google; class RulesRegistration extends Validator @@ -54,6 +55,10 @@ class RulesRegistration extends Validator // Проверим Email self::email($data['email'], $redirect); + if (EmailSpam::index($data['email']) === true) { + is_return(__('msg.email_forbidden'), 'error', $redirect); + } + if (is_array(AuthModel::checkRepetitions($data['email'], 'email'))) { is_return(__('msg.email_replay'), 'error', $redirect); } diff --git a/composer.json b/composer.json index fa99bcd6..d55a07b0 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,8 @@ "phpmailer/phpmailer": "^6.8.0", "symfony/dom-crawler": "6.0.x-dev", "symfony/css-selector": "6.0.x-dev", - "guzzlehttp/guzzle": "7.7.x-dev" + "guzzlehttp/guzzle": "7.7.x-dev", + "gemorroj/stop-spam": "dev-master" }, "autoload": { "classmap": [ diff --git a/config/integration.php b/config/integration.php index e5798e5a..ed8bffe5 100644 --- a/config/integration.php +++ b/config/integration.php @@ -36,7 +36,10 @@ return [ // Screenshots of the service https://screenshotone.com/ // Скриншоты сервиса https://screenshotone.com/ - 'sc_access_key' => '***', - 'sc_secret_key' => '***', + 'sc_access_key' => '***', + 'sc_secret_key' => '***', + // Enable spam detection (email) on stopforumspam.com + // Включить определение спама (email) по stopforumspam.com + 'stopforumspam' => false, ];