From 07af169a2df4dc5a076f1b3d7bc478731a15abc7 Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Tue, 22 Sep 2020 09:15:34 +0100 Subject: [PATCH 1/2] fix(login component validation not working) --- stubs/auth/app/Http/Livewire/Auth/Login.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stubs/auth/app/Http/Livewire/Auth/Login.php b/stubs/auth/app/Http/Livewire/Auth/Login.php index 8544133..29a9cf8 100644 --- a/stubs/auth/app/Http/Livewire/Auth/Login.php +++ b/stubs/auth/app/Http/Livewire/Auth/Login.php @@ -17,12 +17,14 @@ class Login extends Component /** @var bool */ public $remember = false; + protected $rules = [ + 'email' => ['required', 'email'], + 'password' => ['required'], + ]; + public function authenticate() { - $credentials = $this->validate([ - 'email' => ['required', 'email'], - 'password' => ['required'], - ]); + $credentials = $this->validate(); if (!Auth::attempt($credentials, $this->remember)) { $this->addError('email', trans('auth.failed')); From 90df515f3a74e53a987e824377ca14c89ca8fd61 Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Tue, 22 Sep 2020 09:18:13 +0100 Subject: [PATCH 2/2] fix(credentials array) --- stubs/auth/app/Http/Livewire/Auth/Login.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/auth/app/Http/Livewire/Auth/Login.php b/stubs/auth/app/Http/Livewire/Auth/Login.php index 29a9cf8..681c7fe 100644 --- a/stubs/auth/app/Http/Livewire/Auth/Login.php +++ b/stubs/auth/app/Http/Livewire/Auth/Login.php @@ -24,9 +24,9 @@ class Login extends Component public function authenticate() { - $credentials = $this->validate(); + $this->validate(); - if (!Auth::attempt($credentials, $this->remember)) { + if (!Auth::attempt(['email' => $this->email, 'password' => $this->password], $this->remember)) { $this->addError('email', trans('auth.failed')); return;