From 9b6643226da6bd3803da22fb5dc695b1a279c5aa Mon Sep 17 00:00:00 2001 From: byjml Date: Wed, 4 Dec 2019 21:57:13 +0300 Subject: [PATCH 01/10] Consistent order (#5167) Keep the alphabetical order of the validation messages. --- resources/lang/en/passwords.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index 86f1082b..724de4b9 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -15,8 +15,8 @@ return [ 'reset' => 'Your password has been reset!', 'sent' => 'We have e-mailed your password reset link!', + 'throttled' => 'Please wait before retrying.', 'token' => 'This password reset token is invalid.', 'user' => "We can't find a user with that e-mail address.", - 'throttled' => 'Please wait before retrying.', ]; From f4b1dc6df04f4ef9b4b15e2c38668e8cb168c253 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 6 Dec 2019 16:46:02 +0100 Subject: [PATCH 02/10] [6.x] Implement integration test and in-memory DB (#5169) * Use in-memory DB for testing * Extend from PHPUnit test case for unit tests --- phpunit.xml | 2 ++ tests/Unit/ExampleTest.php | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index c1a4100a..7b127c31 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -28,6 +28,8 @@ + + diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index 266ef352..358cfc88 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -2,8 +2,7 @@ namespace Tests\Unit; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Tests\TestCase; +use PHPUnit\Framework\TestCase; class ExampleTest extends TestCase { From 972f3cd2832cd8a8e9e0be96817d10840b735316 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 10 Dec 2019 08:59:27 -0600 Subject: [PATCH 03/10] DRY up path (#5173) --- app/Http/Controllers/Auth/ConfirmPasswordController.php | 3 ++- app/Http/Controllers/Auth/LoginController.php | 3 ++- app/Http/Controllers/Auth/RegisterController.php | 3 ++- app/Http/Controllers/Auth/ResetPasswordController.php | 3 ++- app/Http/Controllers/Auth/VerificationController.php | 3 ++- app/Http/Middleware/RedirectIfAuthenticated.php | 3 ++- app/Providers/RouteServiceProvider.php | 7 +++++++ 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Auth/ConfirmPasswordController.php index 3559954c..138c1f08 100644 --- a/app/Http/Controllers/Auth/ConfirmPasswordController.php +++ b/app/Http/Controllers/Auth/ConfirmPasswordController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; +use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\ConfirmsPasswords; class ConfirmPasswordController extends Controller @@ -25,7 +26,7 @@ class ConfirmPasswordController extends Controller * * @var string */ - protected $redirectTo = '/home'; + protected $redirectTo = RouteServiceProvider::HOME; /** * Create a new controller instance. diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index b2ea669a..18a0d088 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; +use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\AuthenticatesUsers; class LoginController extends Controller @@ -25,7 +26,7 @@ class LoginController extends Controller * * @var string */ - protected $redirectTo = '/home'; + protected $redirectTo = RouteServiceProvider::HOME; /** * Create a new controller instance. diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 6fdcba0a..c6a6de67 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; +use App\Providers\RouteServiceProvider; use App\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; @@ -28,7 +29,7 @@ class RegisterController extends Controller * * @var string */ - protected $redirectTo = '/home'; + protected $redirectTo = RouteServiceProvider::HOME; /** * Create a new controller instance. diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index fe965b24..b1726a36 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; +use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\ResetsPasswords; class ResetPasswordController extends Controller @@ -25,5 +26,5 @@ class ResetPasswordController extends Controller * * @var string */ - protected $redirectTo = '/home'; + protected $redirectTo = RouteServiceProvider::HOME; } diff --git a/app/Http/Controllers/Auth/VerificationController.php b/app/Http/Controllers/Auth/VerificationController.php index 23a43a84..5e749af8 100644 --- a/app/Http/Controllers/Auth/VerificationController.php +++ b/app/Http/Controllers/Auth/VerificationController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; +use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\VerifiesEmails; class VerificationController extends Controller @@ -25,7 +26,7 @@ class VerificationController extends Controller * * @var string */ - protected $redirectTo = '/home'; + protected $redirectTo = RouteServiceProvider::HOME; /** * Create a new controller instance. diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e4cec9c8..2395ddcc 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use App\Providers\RouteServiceProvider; use Closure; use Illuminate\Support\Facades\Auth; @@ -18,7 +19,7 @@ class RedirectIfAuthenticated public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { - return redirect('/home'); + return redirect(RouteServiceProvider::HOME); } return $next($request); diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 548e4be7..527eee34 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -16,6 +16,13 @@ class RouteServiceProvider extends ServiceProvider */ protected $namespace = 'App\Http\Controllers'; + /** + * The path to the "home" route for your application. + * + * @var string + */ + public const HOME = '/home'; + /** * Define your route model bindings, pattern filters, etc. * From 136085bfd8361969a7daedc2308e0b59dbd41f60 Mon Sep 17 00:00:00 2001 From: Bert Heyman Date: Fri, 13 Dec 2019 15:18:09 +0100 Subject: [PATCH 04/10] Add "none" to supported same site options in session config (#5174) --- config/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/session.php b/config/session.php index fbb9b4d7..857ebc3e 100644 --- a/config/session.php +++ b/config/session.php @@ -190,7 +190,7 @@ return [ | take place, and can be used to mitigate CSRF attacks. By default, we | do not enable this as other CSRF protection services are in place. | - | Supported: "lax", "strict" + | Supported: "lax", "strict", "none" | */ From f48e2d500cb53cc4a09dfcb40beb0abafd79de4f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 13 Dec 2019 22:42:46 -0600 Subject: [PATCH 05/10] change some default settings --- .env.example | 2 +- config/logging.php | 2 +- config/session.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 604b401f..a09f5cb4 100644 --- a/.env.example +++ b/.env.example @@ -16,7 +16,7 @@ DB_PASSWORD= BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync -SESSION_DRIVER=file +SESSION_DRIVER=cookie SESSION_LIFETIME=120 REDIS_HOST=127.0.0.1 diff --git a/config/logging.php b/config/logging.php index 0df82129..ad0aba78 100644 --- a/config/logging.php +++ b/config/logging.php @@ -37,7 +37,7 @@ return [ 'channels' => [ 'stack' => [ 'driver' => 'stack', - 'channels' => ['daily'], + 'channels' => ['single'], 'ignore_exceptions' => false, ], diff --git a/config/session.php b/config/session.php index fbb9b4d7..f99e2e64 100644 --- a/config/session.php +++ b/config/session.php @@ -18,7 +18,7 @@ return [ | */ - 'driver' => env('SESSION_DRIVER', 'file'), + 'driver' => env('SESSION_DRIVER', 'cookie'), /* |-------------------------------------------------------------------------- From 40f93daa83b17ad47c51ec9beed4c1ba79eb66ed Mon Sep 17 00:00:00 2001 From: Can Vural Date: Sat, 14 Dec 2019 11:48:14 +0100 Subject: [PATCH 06/10] Update redirectTo return type PHPDoc --- app/Http/Middleware/Authenticate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index a4be5c58..704089a7 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -10,7 +10,7 @@ class Authenticate extends Middleware * Get the path the user should be redirected to when they are not authenticated. * * @param \Illuminate\Http\Request $request - * @return string + * @return string|null */ protected function redirectTo($request) { From 17f0ff22057a028f28b8aa17fadbc7fe4136bf66 Mon Sep 17 00:00:00 2001 From: Michael Stokoe Date: Wed, 18 Dec 2019 15:38:03 +0000 Subject: [PATCH 07/10] Updated config/logging.php (#5179) This adds a default emergency logger path to the logging config file. This change goes hand-in-hand with my changes found here: https://github.com/Stokoe0990/framework/commit/7a03776bc860bde4cdc82e69ab133a755b66dd2d --- config/logging.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/logging.php b/config/logging.php index ad0aba78..088c204e 100644 --- a/config/logging.php +++ b/config/logging.php @@ -95,6 +95,10 @@ return [ 'driver' => 'monolog', 'handler' => NullHandler::class, ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), + ], ], ]; From c5f9126981fe340edf71de284b27926323d3271b Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Wed, 18 Dec 2019 09:41:11 -0600 Subject: [PATCH 08/10] default email from name to app name (#5178) --- config/mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/mail.php b/config/mail.php index 3c65eb3f..c6a8df81 100644 --- a/config/mail.php +++ b/config/mail.php @@ -57,7 +57,7 @@ return [ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Example')), ], /* From b2734a9c313ac637e9b8cffa80f9fa9d3da96a09 Mon Sep 17 00:00:00 2001 From: Anton Komarev <1849174+antonkomarev@users.noreply.github.com> Date: Wed, 18 Dec 2019 20:17:32 +0300 Subject: [PATCH 09/10] Add MAIL_FROM_ADDRESS & MAIL_FROM_NAME to .env file (#5180) --- .env.example | 2 ++ config/mail.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index a09f5cb4..39e35b24 100644 --- a/.env.example +++ b/.env.example @@ -29,6 +29,8 @@ MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS=null +MAIL_FROM_NAME="${APP_NAME}" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= diff --git a/config/mail.php b/config/mail.php index c6a8df81..3c65eb3f 100644 --- a/config/mail.php +++ b/config/mail.php @@ -57,7 +57,7 @@ return [ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Example')), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* From 140d4d9b0a4581cec046875361e87c2981b3f9fe Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 18 Dec 2019 12:02:46 -0600 Subject: [PATCH 10/10] use class name to be consistent with web middleware --- app/Http/Kernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 2741c0a3..deb65e86 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -39,7 +39,7 @@ class Kernel extends HttpKernel 'api' => [ 'throttle:60,1', - 'bindings', + \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ];