diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index b2ea669a0..83f844da6 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -36,4 +36,24 @@ class LoginController extends Controller { $this->middleware('guest')->except('logout'); } + + /** + * Validate the user login request. + * + * @param \Illuminate\Http\Request $request + * @return void + */ + public function validateLogin($request) + { + $rules = [ + $this->username() => 'required|string', + 'password' => 'required|string', + ]; + + if(config('pixelfed.recaptcha')) { + $rules['g-recaptcha-response'] = 'required|recaptcha'; + } + + $this->validate($request, $rules); + } } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index a2c36356f..1b9de0513 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -52,12 +52,19 @@ class RegisterController extends Controller { $this->validateUsername($data['username']); - return Validator::make($data, [ + + $rules = [ 'name' => 'required|string|max:255', 'username' => 'required|alpha_dash|min:2|max:15|unique:users', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|confirmed', - ]); + ]; + + if(config('pixelfed.recaptcha')) { + $rules['g-recaptcha-response'] = 'required|recaptcha'; + } + + return Validator::make($data, $rules); } /** diff --git a/composer.json b/composer.json index 2290917a5..17f6b01d6 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "99designs/http-signatures-guzzlehttp": "^2.0", "bitverse/identicon": "^1.1", "fideloper/proxy": "^4.0", + "greggilbert/recaptcha": "dev-master", "intervention/image": "^2.4", "kitetail/zttp": "^0.3.0", "laravel/framework": "5.6.*", diff --git a/composer.lock b/composer.lock index 217cadc29..879680005 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "97f3eec3dc712904b69a71f92d0e3a3f", + "content-hash": "7be7e27683f56b7ec28eeef962cf2437", "packages": [ { "name": "99designs/http-signatures", @@ -571,6 +571,58 @@ ], "time": "2018-02-07T20:20:57+00:00" }, + { + "name": "greggilbert/recaptcha", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/greggilbert/recaptcha.git", + "reference": "c2ed383785a4fe20467ce470c97c303e5c5b85de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/greggilbert/recaptcha/zipball/c2ed383785a4fe20467ce470c97c303e5c5b85de", + "reference": "c2ed383785a4fe20467ce470c97c303e5c5b85de", + "shasum": "" + }, + "require": { + "illuminate/support": "~5.1", + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/migrations" + ], + "psr-4": { + "Greggilbert\\Recaptcha\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Greg Gilbert", + "email": "greg@greg-gilbert.com" + } + ], + "description": "reCAPTCHA Validator for Laravel 5", + "homepage": "http://github.com/greggilbert/recaptcha", + "keywords": [ + "captcha", + "laravel", + "laravel5", + "recaptcha" + ], + "time": "2017-08-31T03:39:47+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.3.3", @@ -754,16 +806,16 @@ }, { "name": "intervention/image", - "version": "2.4.1", + "version": "2.4.2", "source": { "type": "git", "url": "https://github.com/Intervention/image.git", - "reference": "3603dbcc9a17d307533473246a6c58c31cf17919" + "reference": "e82d274f786e3d4b866a59b173f42e716f0783eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Intervention/image/zipball/3603dbcc9a17d307533473246a6c58c31cf17919", - "reference": "3603dbcc9a17d307533473246a6c58c31cf17919", + "url": "https://api.github.com/repos/Intervention/image/zipball/e82d274f786e3d4b866a59b173f42e716f0783eb", + "reference": "e82d274f786e3d4b866a59b173f42e716f0783eb", "shasum": "" }, "require": { @@ -783,7 +835,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.4-dev" }, "laravel": { "providers": [ @@ -820,7 +872,7 @@ "thumbnail", "watermark" ], - "time": "2017-09-21T16:29:17+00:00" + "time": "2018-05-29T14:19:03+00:00" }, { "name": "jakub-onderka/php-console-color", @@ -2315,16 +2367,16 @@ }, { "name": "symfony/console", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "058f120b8e06ebcd7b211de5ffae07b2db00fbdd" + "reference": "2d5d973bf9933d46802b01010bd25c800c87c242" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/058f120b8e06ebcd7b211de5ffae07b2db00fbdd", - "reference": "058f120b8e06ebcd7b211de5ffae07b2db00fbdd", + "url": "https://api.github.com/repos/symfony/console/zipball/2d5d973bf9933d46802b01010bd25c800c87c242", + "reference": "2d5d973bf9933d46802b01010bd25c800c87c242", "shasum": "" }, "require": { @@ -2352,7 +2404,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2379,20 +2431,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-05-16T09:05:32+00:00" + "time": "2018-05-30T07:26:09+00:00" }, { "name": "symfony/css-selector", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "0383a1a4eb1ffcac28719975d3e01bfa14be8ab3" + "reference": "03ac71606ecb0b0ce792faa17d74cc32c2949ef4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/0383a1a4eb1ffcac28719975d3e01bfa14be8ab3", - "reference": "0383a1a4eb1ffcac28719975d3e01bfa14be8ab3", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/03ac71606ecb0b0ce792faa17d74cc32c2949ef4", + "reference": "03ac71606ecb0b0ce792faa17d74cc32c2949ef4", "shasum": "" }, "require": { @@ -2401,7 +2453,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2432,20 +2484,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2018-05-11T15:58:37+00:00" + "time": "2018-05-30T07:26:09+00:00" }, { "name": "symfony/debug", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "4e7c98de67cc4171d4c986554e09a511da40f3d8" + "reference": "449f8b00b28ab6e6912c3e6b920406143b27193b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/4e7c98de67cc4171d4c986554e09a511da40f3d8", - "reference": "4e7c98de67cc4171d4c986554e09a511da40f3d8", + "url": "https://api.github.com/repos/symfony/debug/zipball/449f8b00b28ab6e6912c3e6b920406143b27193b", + "reference": "449f8b00b28ab6e6912c3e6b920406143b27193b", "shasum": "" }, "require": { @@ -2461,7 +2513,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2488,20 +2540,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-05-16T09:05:32+00:00" + "time": "2018-05-16T14:33:22+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "63353a71073faf08f62caab4e6889b06a787f07b" + "reference": "2391ed210a239868e7256eb6921b1bd83f3087b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/63353a71073faf08f62caab4e6889b06a787f07b", - "reference": "63353a71073faf08f62caab4e6889b06a787f07b", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2391ed210a239868e7256eb6921b1bd83f3087b5", + "reference": "2391ed210a239868e7256eb6921b1bd83f3087b5", "shasum": "" }, "require": { @@ -2524,7 +2576,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2551,20 +2603,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-04-06T07:35:43+00:00" + "time": "2018-04-06T07:35:57+00:00" }, { "name": "symfony/finder", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "8c633f5a815903a1fe6e3fc135f207267a8a79af" + "reference": "087e2ee0d74464a4c6baac4e90417db7477dc238" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8c633f5a815903a1fe6e3fc135f207267a8a79af", - "reference": "8c633f5a815903a1fe6e3fc135f207267a8a79af", + "url": "https://api.github.com/repos/symfony/finder/zipball/087e2ee0d74464a4c6baac4e90417db7477dc238", + "reference": "087e2ee0d74464a4c6baac4e90417db7477dc238", "shasum": "" }, "require": { @@ -2573,7 +2625,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2600,20 +2652,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-05-16T09:05:32+00:00" + "time": "2018-05-16T14:33:22+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "277b757a2d3960170d99d372e171a8a18916467a" + "reference": "a916c88390fb861ee21f12a92b107d51bb68af99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/277b757a2d3960170d99d372e171a8a18916467a", - "reference": "277b757a2d3960170d99d372e171a8a18916467a", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a916c88390fb861ee21f12a92b107d51bb68af99", + "reference": "a916c88390fb861ee21f12a92b107d51bb68af99", "shasum": "" }, "require": { @@ -2621,12 +2673,13 @@ "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { + "predis/predis": "~1.0", "symfony/expression-language": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2653,34 +2706,34 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-05-25T11:08:56+00:00" + "time": "2018-05-25T14:55:38+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "450a1bda817f2dce25a9e13f0f011336743f2a48" + "reference": "b5ab9d4cdbfd369083744b6b5dfbf454e31e5f90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/450a1bda817f2dce25a9e13f0f011336743f2a48", - "reference": "450a1bda817f2dce25a9e13f0f011336743f2a48", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b5ab9d4cdbfd369083744b6b5dfbf454e31e5f90", + "reference": "b5ab9d4cdbfd369083744b6b5dfbf454e31e5f90", "shasum": "" }, "require": { "php": "^7.1.3", "psr/log": "~1.0", "symfony/debug": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/http-foundation": "~3.4.4|~4.0.4", + "symfony/event-dispatcher": "~4.1", + "symfony/http-foundation": "~4.1", "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4.5|<4.0.5,>=4", - "symfony/var-dumper": "<3.4", + "symfony/dependency-injection": "<4.1", + "symfony/var-dumper": "<4.1", "twig/twig": "<1.34|<2.4,>=2" }, "provide": { @@ -2692,7 +2745,7 @@ "symfony/config": "~3.4|~4.0", "symfony/console": "~3.4|~4.0", "symfony/css-selector": "~3.4|~4.0", - "symfony/dependency-injection": "^3.4.5|^4.0.5", + "symfony/dependency-injection": "^4.1", "symfony/dom-crawler": "~3.4|~4.0", "symfony/expression-language": "~3.4|~4.0", "symfony/finder": "~3.4|~4.0", @@ -2701,7 +2754,7 @@ "symfony/stopwatch": "~3.4|~4.0", "symfony/templating": "~3.4|~4.0", "symfony/translation": "~3.4|~4.0", - "symfony/var-dumper": "~3.4|~4.0" + "symfony/var-dumper": "~4.1" }, "suggest": { "symfony/browser-kit": "", @@ -2713,7 +2766,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2740,7 +2793,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-05-25T13:32:52+00:00" + "time": "2018-05-30T12:52:34+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2913,16 +2966,16 @@ }, { "name": "symfony/process", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "3621fa74d0576a6f89d63bc44fabd376711bd0b0" + "reference": "73445bd33b0d337c060eef9652b94df72b6b3434" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3621fa74d0576a6f89d63bc44fabd376711bd0b0", - "reference": "3621fa74d0576a6f89d63bc44fabd376711bd0b0", + "url": "https://api.github.com/repos/symfony/process/zipball/73445bd33b0d337c060eef9652b94df72b6b3434", + "reference": "73445bd33b0d337c060eef9652b94df72b6b3434", "shasum": "" }, "require": { @@ -2931,7 +2984,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -2958,20 +3011,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-05-16T09:05:32+00:00" + "time": "2018-05-30T07:26:09+00:00" }, { "name": "symfony/routing", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e8833b64b139926cbe1610d53722185e55c18e44" + "reference": "180b51c66d10f09e562c9ebc395b39aacb2cf8a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e8833b64b139926cbe1610d53722185e55c18e44", - "reference": "e8833b64b139926cbe1610d53722185e55c18e44", + "url": "https://api.github.com/repos/symfony/routing/zipball/180b51c66d10f09e562c9ebc395b39aacb2cf8a2", + "reference": "180b51c66d10f09e562c9ebc395b39aacb2cf8a2", "shasum": "" }, "require": { @@ -3003,7 +3056,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -3036,20 +3089,20 @@ "uri", "url" ], - "time": "2018-05-16T14:21:07+00:00" + "time": "2018-05-30T07:26:09+00:00" }, { "name": "symfony/translation", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e1f5863d0a9e79cfec7f031421ced3fe1d403e66" + "reference": "16328f5b217cebc8dd4adfe4aeeaa8c377581f5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e1f5863d0a9e79cfec7f031421ced3fe1d403e66", - "reference": "e1f5863d0a9e79cfec7f031421ced3fe1d403e66", + "url": "https://api.github.com/repos/symfony/translation/zipball/16328f5b217cebc8dd4adfe4aeeaa8c377581f5a", + "reference": "16328f5b217cebc8dd4adfe4aeeaa8c377581f5a", "shasum": "" }, "require": { @@ -3064,6 +3117,7 @@ "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", "symfony/finder": "~2.8|~3.0|~4.0", "symfony/intl": "~3.4|~4.0", @@ -3077,7 +3131,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -3104,20 +3158,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2018-05-21T10:09:47+00:00" + "time": "2018-05-30T07:26:09+00:00" }, { "name": "symfony/var-dumper", - "version": "v4.0.11", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "3c34cf3f4bbac9e003d9325225e9ef1a49180a18" + "reference": "bc88ad53e825ebacc7b190bbd360781fce381c64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3c34cf3f4bbac9e003d9325225e9ef1a49180a18", - "reference": "3c34cf3f4bbac9e003d9325225e9ef1a49180a18", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/bc88ad53e825ebacc7b190bbd360781fce381c64", + "reference": "bc88ad53e825ebacc7b190bbd360781fce381c64", "shasum": "" }, "require": { @@ -3126,20 +3180,26 @@ "symfony/polyfill-php72": "~1.5" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" }, "require-dev": { "ext-iconv": "*", + "symfony/process": "~3.4|~4.0", "twig/twig": "~1.34|~2.4" }, "suggest": { "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump" + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" }, + "bin": [ + "Resources/bin/var-dump-server" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -3173,7 +3233,7 @@ "debug", "dump" ], - "time": "2018-04-26T16:12:06+00:00" + "time": "2018-04-29T07:56:09+00:00" }, { "name": "tightenco/collect", @@ -3734,25 +3794,28 @@ }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/478465659fd987669df0bd8a9bf22a8710e5f1b6", + "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -3775,7 +3838,7 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2018-05-29T17:25:09+00:00" }, { "name": "nunomaduro/collision", @@ -4158,23 +4221,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.0.4", + "version": "6.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "52187754b0eed0b8159f62a6fa30073327e8c2ca" + "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/52187754b0eed0b8159f62a6fa30073327e8c2ca", - "reference": "52187754b0eed0b8159f62a6fa30073327e8c2ca", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", + "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", "php": "^7.1", - "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", @@ -4217,29 +4280,29 @@ "testing", "xunit" ], - "time": "2018-04-29T14:59:09+00:00" + "time": "2018-06-01T07:51:50+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "e20525b0c2945c7c317fff95660698cb3d2a53bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/e20525b0c2945c7c317fff95660698cb3d2a53bc", + "reference": "e20525b0c2945c7c317fff95660698cb3d2a53bc", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -4254,7 +4317,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -4264,7 +4327,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-05-28T12:13:49+00:00" }, { "name": "phpunit/php-text-template", @@ -4407,34 +4470,34 @@ }, { "name": "phpunit/phpunit", - "version": "7.1.5", + "version": "7.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ca64dba53b88aba6af32aebc6b388068db95c435" + "reference": "3cf0836680bf5c365c627e8566d46c9e1f544db9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ca64dba53b88aba6af32aebc6b388068db95c435", - "reference": "ca64dba53b88aba6af32aebc6b388068db95c435", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3cf0836680bf5c365c627e8566d46c9e1f544db9", + "reference": "3cf0836680bf5c365c627e8566d46c9e1f544db9", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", + "myclabs/deep-copy": "^1.7", "phar-io/manifest": "^1.0.1", "phar-io/version": "^1.0", "php": "^7.1", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.1", - "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^2.0", - "phpunit/phpunit-mock-objects": "^6.1.1", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", "sebastian/environment": "^3.1", @@ -4444,10 +4507,14 @@ "sebastian/resource-operations": "^1.0", "sebastian/version": "^2.0.1" }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", "phpunit/php-invoker": "^2.0" }, @@ -4457,7 +4524,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.1-dev" + "dev-master": "7.2-dev" } }, "autoload": { @@ -4483,63 +4550,7 @@ "testing", "xunit" ], - "time": "2018-04-29T15:09:19+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "6.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "70c740bde8fd9ea9ea295be1cd875dd7b267e157" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/70c740bde8fd9ea9ea295be1cd875dd7b267e157", - "reference": "70c740bde8fd9ea9ea295be1cd875dd7b267e157", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.1", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2018-04-11T04:50:36+00:00" + "time": "2018-06-01T07:54:27+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -5197,7 +5208,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "greggilbert/recaptcha": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/config/app.php b/config/app.php index b16e7f77e..99e219a52 100644 --- a/config/app.php +++ b/config/app.php @@ -150,6 +150,7 @@ return [ /* * Package Service Providers... */ + Greggilbert\Recaptcha\RecaptchaServiceProvider::class, /* * Application Service Providers... @@ -209,6 +210,7 @@ return [ 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, + 'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class, ], ]; diff --git a/config/pixelfed.php b/config/pixelfed.php index 69a8f3dfb..9c33a56cf 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -71,6 +71,7 @@ return [ | */ 'open_registration' => env('OPEN_REGISTRATION', true), + 'recaptcha' => env('RECAPTCHA_ENABLED', false), 'remote_follow_enabled' => env('REMOTE_FOLLOW', false), diff --git a/config/recaptcha.php b/config/recaptcha.php new file mode 100644 index 000000000..5caa2c413 --- /dev/null +++ b/config/recaptcha.php @@ -0,0 +1,66 @@ + env('RECAPTCHA_PUBLIC_KEY', ''), + 'private_key' => env('RECAPTCHA_PRIVATE_KEY', ''), + + /* + |-------------------------------------------------------------------------- + | Template + |-------------------------------------------------------------------------- + | + | Set a template to use if you don't want to use the standard one. + | + */ + 'template' => '', + + /* + |-------------------------------------------------------------------------- + | Driver + |-------------------------------------------------------------------------- + | + | Determine how to call out to get response; values are 'curl' or 'native'. + | Only applies to v2. + | + */ + 'driver' => 'curl', + + /* + |-------------------------------------------------------------------------- + | Options + |-------------------------------------------------------------------------- + | + | Various options for the driver + | + */ + 'options' => [ + + 'curl_timeout' => 1, + 'curl_verify' => true, + + ], + + /* + |-------------------------------------------------------------------------- + | Version + |-------------------------------------------------------------------------- + | + | Set which version of ReCaptcha to use. + | + */ + + 'version' => 2, + +]; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index c09b128f2..66d0cfa53 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -47,6 +47,12 @@ + @if(config('pixelfed.recaptcha')) +
+ {!! Recaptcha::render() !!} +
+ @endif +
+ @if(config('pixelfed.recaptcha')) +
+ {!! Recaptcha::render() !!} +
+ @endif +