From a265940328e44d553359d2763049dfd8039dce8d Mon Sep 17 00:00:00 2001 From: Lee Watson Date: Sat, 2 Jul 2016 16:04:17 +0100 Subject: [PATCH] Add Honeypot service to further reduce spambots registering --- app/Http/Controllers/Auth/AuthController.php | 4 +- composer.json | 6 +- composer.lock | 223 +++++++++++-------- config/app.php | 2 + resources/lang/en/messages.php | 2 +- resources/views/auth/register.blade.php | 1 + 6 files changed, 148 insertions(+), 90 deletions(-) diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index f96a814..b876385 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -62,7 +62,7 @@ public function postRegister(Request $request) }); if (config('upste.require_user_approval')) { - flash()->success(trans('messages.activation_pending'))->important(); + flash()->success(trans('messages.activation_pending', ['email' => $user->email]))->important(); } else { Auth::login($user); } @@ -82,6 +82,8 @@ protected function validator(array $data) 'name' => 'required|max:255|unique:users|alpha_num', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6', + 'my_name' => 'honeypot', + 'my_time' => 'required|honeytime:5' ]; if (config('upste.recaptcha_enabled')) { diff --git a/composer.json b/composer.json index d48de87..eda4761 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,8 @@ "laracasts/flash": "1.3.*", "shrikeh/teapot": "1.0.*", "intervention/image": "^2.3", - "greggilbert/recaptcha": "^2.1" + "greggilbert/recaptcha": "^2.1", + "msurguy/honeypot": "^1.0" }, "require-dev": { "fzaninotto/faker": "~1.4", @@ -66,6 +67,9 @@ "php artisan down" ], "post-update-cmd": [ + "Illuminate\\Foundation\\ComposerScripts::postUpdate", + "php artisan ide-helper:generate", + "php artisan ide-helper:meta", "npm update", "gulp --production", "php artisan migrate", diff --git a/composer.lock b/composer.lock index 738b3f2..3e13fd6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "fb78aa53c07e8849153347df2c8f8dbd", - "content-hash": "ea0fc090cabb0d62fc9a0f64a8926e46", + "hash": "8961de6e27ad11f71656baf23a1d4540", + "content-hash": "264dec34ac60a740fcd94e270b1d4c66", "packages": [ { "name": "barryvdh/laravel-debugbar", @@ -724,16 +724,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "31382fef2889136415751badebbd1cb022a4ed72" + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72", - "reference": "31382fef2889136415751badebbd1cb022a4ed72", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", "shasum": "" }, "require": { @@ -749,7 +749,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -778,7 +778,7 @@ "stream", "uri" ], - "time": "2016-04-13 19:56:01" + "time": "2016-06-24 23:00:38" }, { "name": "intervention/image", @@ -1305,16 +1305,16 @@ }, { "name": "monolog/monolog", - "version": "1.19.0", + "version": "1.20.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf" + "reference": "55841909e2bcde01b5318c35f2b74f8ecc86e037" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5f56ed5212dc509c8dc8caeba2715732abb32dbf", - "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/55841909e2bcde01b5318c35f2b74f8ecc86e037", + "reference": "55841909e2bcde01b5318c35f2b74f8ecc86e037", "shasum": "" }, "require": { @@ -1333,8 +1333,8 @@ "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "^0.13", "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", "swiftmailer/swiftmailer": "~5.3" }, "suggest": { @@ -1346,9 +1346,9 @@ "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", - "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" }, "type": "library", "extra": { @@ -1379,7 +1379,56 @@ "logging", "psr-3" ], - "time": "2016-04-12 18:29:35" + "time": "2016-07-02 14:02:10" + }, + { + "name": "msurguy/honeypot", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/msurguy/Honeypot.git", + "reference": "1ae75cfa11cc02fdc3b1e53363d3122203e7e7f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/msurguy/Honeypot/zipball/1ae75cfa11cc02fdc3b1e53363d3122203e7e7f9", + "reference": "1ae75cfa11cc02fdc3b1e53363d3122203e7e7f9", + "shasum": "" + }, + "require": { + "illuminate/config": "4.*|5.*", + "illuminate/support": "4.*|5.*", + "illuminate/translation": "4.*|5.*", + "php": ">=5.3.0" + }, + "require-dev": { + "mockery/mockery": "0.9.*", + "phpunit/phpunit": "4.0.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "Msurguy\\Honeypot\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maksim Surguy", + "email": "m.surguy@gmail.com" + } + ], + "description": "Honeypot spam prevention", + "keywords": [ + "Forms", + "Honeypot", + "laravel", + "spam" + ], + "time": "2016-01-31 23:09:00" }, { "name": "mtdowling/cron-expression", @@ -1953,16 +2002,16 @@ }, { "name": "symfony/class-loader", - "version": "v3.1.1", + "version": "v3.1.2", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "6ebc60f69a6df4b3cf5ad6f260ba4edf5957ea05" + "reference": "0d0ac77c336eb73f35bebdf3e1f3695ac741bbc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/6ebc60f69a6df4b3cf5ad6f260ba4edf5957ea05", - "reference": "6ebc60f69a6df4b3cf5ad6f260ba4edf5957ea05", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/0d0ac77c336eb73f35bebdf3e1f3695ac741bbc9", + "reference": "0d0ac77c336eb73f35bebdf3e1f3695ac741bbc9", "shasum": "" }, "require": { @@ -2005,20 +2054,20 @@ ], "description": "Symfony ClassLoader Component", "homepage": "https://symfony.com", - "time": "2016-03-30 10:41:47" + "time": "2016-06-29 05:41:56" }, { "name": "symfony/console", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "382fc9ed852edabd6133e34f8549d7a7d99db115" + "reference": "a7abb7153f6d1da47f87ec50274844e246b09d9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/382fc9ed852edabd6133e34f8549d7a7d99db115", - "reference": "382fc9ed852edabd6133e34f8549d7a7d99db115", + "url": "https://api.github.com/repos/symfony/console/zipball/a7abb7153f6d1da47f87ec50274844e246b09d9f", + "reference": "a7abb7153f6d1da47f87ec50274844e246b09d9f", "shasum": "" }, "require": { @@ -2065,20 +2114,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-06-06 15:08:35" + "time": "2016-06-29 07:02:21" }, { "name": "symfony/debug", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "e67e1552dd7313df1cf6535cb606751899e0e727" + "reference": "c54bc3539c3b87e86799533801e8ae0e971d78c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/e67e1552dd7313df1cf6535cb606751899e0e727", - "reference": "e67e1552dd7313df1cf6535cb606751899e0e727", + "url": "https://api.github.com/repos/symfony/debug/zipball/c54bc3539c3b87e86799533801e8ae0e971d78c2", + "reference": "c54bc3539c3b87e86799533801e8ae0e971d78c2", "shasum": "" }, "require": { @@ -2122,20 +2171,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-06-06 15:08:35" + "time": "2016-06-29 05:40:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.1.1", + "version": "v3.1.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "f5b7563f67779c6d3d5370e23448e707c858df3e" + "reference": "7f9839ede2070f53e7e2f0849b9bd14748c434c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f5b7563f67779c6d3d5370e23448e707c858df3e", - "reference": "f5b7563f67779c6d3d5370e23448e707c858df3e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7f9839ede2070f53e7e2f0849b9bd14748c434c5", + "reference": "7f9839ede2070f53e7e2f0849b9bd14748c434c5", "shasum": "" }, "require": { @@ -2182,20 +2231,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:42:41" + "time": "2016-06-29 05:41:56" }, { "name": "symfony/finder", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "39e5f3d533d07b5416b9d7aad53a27f939d4f811" + "reference": "3eb4e64c6145ef8b92adefb618a74ebdde9e3fe9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/39e5f3d533d07b5416b9d7aad53a27f939d4f811", - "reference": "39e5f3d533d07b5416b9d7aad53a27f939d4f811", + "url": "https://api.github.com/repos/symfony/finder/zipball/3eb4e64c6145ef8b92adefb618a74ebdde9e3fe9", + "reference": "3eb4e64c6145ef8b92adefb618a74ebdde9e3fe9", "shasum": "" }, "require": { @@ -2231,20 +2280,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-05-13 18:03:36" + "time": "2016-06-29 05:40:00" }, { "name": "symfony/http-foundation", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "d268a643884f85e91d6ba11ca68de96833f3f6e5" + "reference": "1341139f906d295baa4f4abd55293d07e25a065a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d268a643884f85e91d6ba11ca68de96833f3f6e5", - "reference": "d268a643884f85e91d6ba11ca68de96833f3f6e5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1341139f906d295baa4f4abd55293d07e25a065a", + "reference": "1341139f906d295baa4f4abd55293d07e25a065a", "shasum": "" }, "require": { @@ -2284,20 +2333,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:33:26" + "time": "2016-06-29 07:02:21" }, { "name": "symfony/http-kernel", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "97cc1c15e3406e7a2adf14ad6b0e41a04d4a6fc4" + "reference": "177b63b2d50b63fa6d82ea41359ed9928cc7a1fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/97cc1c15e3406e7a2adf14ad6b0e41a04d4a6fc4", - "reference": "97cc1c15e3406e7a2adf14ad6b0e41a04d4a6fc4", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/177b63b2d50b63fa6d82ea41359ed9928cc7a1fb", + "reference": "177b63b2d50b63fa6d82ea41359ed9928cc7a1fb", "shasum": "" }, "require": { @@ -2305,7 +2354,7 @@ "psr/log": "~1.0", "symfony/debug": "~2.8|~3.0", "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/http-foundation": "~2.8|~3.0" + "symfony/http-foundation": "~2.8.8|~3.0.8|~3.1.2|~3.2" }, "conflict": { "symfony/config": "<2.8" @@ -2366,7 +2415,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2016-06-06 16:52:35" + "time": "2016-06-30 16:30:17" }, { "name": "symfony/polyfill-mbstring", @@ -2537,16 +2586,16 @@ }, { "name": "symfony/process", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "bf6e2d1fa8b93fdd7cca6b684c0ea213cf0255dd" + "reference": "d7cde1f9d94d87060204f863779389b61c382eeb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/bf6e2d1fa8b93fdd7cca6b684c0ea213cf0255dd", - "reference": "bf6e2d1fa8b93fdd7cca6b684c0ea213cf0255dd", + "url": "https://api.github.com/repos/symfony/process/zipball/d7cde1f9d94d87060204f863779389b61c382eeb", + "reference": "d7cde1f9d94d87060204f863779389b61c382eeb", "shasum": "" }, "require": { @@ -2582,20 +2631,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:33:26" + "time": "2016-06-29 05:40:00" }, { "name": "symfony/routing", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "c780454838a1131adc756d737a4b4cc1d18f8c64" + "reference": "9038984bd9c05ab07280121e9e10f61a7231457b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/c780454838a1131adc756d737a4b4cc1d18f8c64", - "reference": "c780454838a1131adc756d737a4b4cc1d18f8c64", + "url": "https://api.github.com/repos/symfony/routing/zipball/9038984bd9c05ab07280121e9e10f61a7231457b", + "reference": "9038984bd9c05ab07280121e9e10f61a7231457b", "shasum": "" }, "require": { @@ -2657,20 +2706,20 @@ "uri", "url" ], - "time": "2016-05-30 06:58:27" + "time": "2016-06-29 05:40:00" }, { "name": "symfony/translation", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7" + "reference": "6bf844e1ee3c820c012386c10427a5c67bbefec8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7", - "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7", + "url": "https://api.github.com/repos/symfony/translation/zipball/6bf844e1ee3c820c012386c10427a5c67bbefec8", + "reference": "6bf844e1ee3c820c012386c10427a5c67bbefec8", "shasum": "" }, "require": { @@ -2721,20 +2770,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:33:26" + "time": "2016-06-29 05:40:00" }, { "name": "symfony/var-dumper", - "version": "v3.0.7", + "version": "v3.0.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "d8bb851da153d97abe7c2b71a65dee19f324bcf7" + "reference": "2f046e9a9d571f22cc8b26783564876713b06579" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d8bb851da153d97abe7c2b71a65dee19f324bcf7", - "reference": "d8bb851da153d97abe7c2b71a65dee19f324bcf7", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2f046e9a9d571f22cc8b26783564876713b06579", + "reference": "2f046e9a9d571f22cc8b26783564876713b06579", "shasum": "" }, "require": { @@ -2784,7 +2833,7 @@ "debug", "dump" ], - "time": "2016-05-24 10:03:10" + "time": "2016-06-29 05:40:00" }, { "name": "vlucas/phpdotenv", @@ -3969,16 +4018,16 @@ }, { "name": "symfony/css-selector", - "version": "v3.1.1", + "version": "v3.1.2", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "c526d7b3cb4fe1673c6a34e13be2ff63f519df99" + "reference": "2851e1932d77ce727776154d659b232d061e816a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/c526d7b3cb4fe1673c6a34e13be2ff63f519df99", - "reference": "c526d7b3cb4fe1673c6a34e13be2ff63f519df99", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/2851e1932d77ce727776154d659b232d061e816a", + "reference": "2851e1932d77ce727776154d659b232d061e816a", "shasum": "" }, "require": { @@ -4018,20 +4067,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-06-06 11:42:41" + "time": "2016-06-29 05:41:56" }, { "name": "symfony/dom-crawler", - "version": "v3.1.1", + "version": "v3.1.2", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "12aa63fd41b060d2bee9a34623d29eda70bc8fe3" + "reference": "99ec4a23330fcd0c8667095f3ef7aa204ffd9dc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/12aa63fd41b060d2bee9a34623d29eda70bc8fe3", - "reference": "12aa63fd41b060d2bee9a34623d29eda70bc8fe3", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/99ec4a23330fcd0c8667095f3ef7aa204ffd9dc0", + "reference": "99ec4a23330fcd0c8667095f3ef7aa204ffd9dc0", "shasum": "" }, "require": { @@ -4074,20 +4123,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2016-05-13 15:49:09" + "time": "2016-06-29 05:41:56" }, { "name": "symfony/yaml", - "version": "v3.1.1", + "version": "v3.1.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623" + "reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c5a7e7fc273c758b92b85dcb9c46149ccda89623", - "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623", + "url": "https://api.github.com/repos/symfony/yaml/zipball/2884c26ce4c1d61aebf423a8b912950fe7c764de", + "reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de", "shasum": "" }, "require": { @@ -4123,7 +4172,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-06-14 11:18:07" + "time": "2016-06-29 05:41:56" } ], "aliases": [], diff --git a/config/app.php b/config/app.php index f9fe442..10d1b5d 100644 --- a/config/app.php +++ b/config/app.php @@ -148,6 +148,7 @@ App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, Laracasts\Flash\FlashServiceProvider::class, + Msurguy\Honeypot\HoneypotServiceProvider::class, ], @@ -179,6 +180,7 @@ 'File' => Illuminate\Support\Facades\File::class, 'Flash' => Laracasts\Flash\Flash::class, 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Honeypot' => Msurguy\Honeypot\HoneypotFacade::class, 'Image' => Intervention\Image\Facades\Image::class, 'Inspiring' => Illuminate\Foundation\Inspiring::class, 'Lang' => Illuminate\Support\Facades\Lang::class, diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index fca9f69..a1b039e 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -15,7 +15,7 @@ 'banned' => 'You are banned. Contact an admin if you believe this is an error.', 'not_logged_in' => 'You must log in to access that page.', 'not_activated' => 'Your account has not been approved. You will be notified via email when your account status changes.', - 'activation_pending' => 'Your account request has successfully been registered. You will receive an email when an admin accepts or rejects your request.', + 'activation_pending' => 'Your account request has been successfully registered. You will receive a notification email at :email when an admin accepts or rejects your request.', 'admin' => [ 'no_uploads_found' => ':name has no uploads.', 'unbanned_user' => 'Unbanned :name.', diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index c18a017..fd643cb 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -23,6 +23,7 @@ {!! Recaptcha::render() !!} @endif + {!! Honeypot::generate('my_name', 'my_time') !!}