From 704eb728bc0395fff946da877710b4bd29c71f24 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 29 Jun 2021 02:16:57 -0700 Subject: [PATCH] Added livewire the login screen Signed-off-by: snipe --- app/Http/Livewire/LoginForm.php | 67 +++++++++++ resources/views/auth/login.blade.php | 86 +------------- resources/views/livewire/login-form.blade.php | 105 ++++++++++++++++++ 3 files changed, 173 insertions(+), 85 deletions(-) create mode 100644 app/Http/Livewire/LoginForm.php create mode 100644 resources/views/livewire/login-form.blade.php diff --git a/app/Http/Livewire/LoginForm.php b/app/Http/Livewire/LoginForm.php new file mode 100644 index 0000000000..78b73f9468 --- /dev/null +++ b/app/Http/Livewire/LoginForm.php @@ -0,0 +1,67 @@ + + * @version v6.0 + * @return Array + */ + public function rules() + { + return [ + 'username' => 'required|string|max:255', + 'password' => 'required', + ]; + } + + /** + * Perform the validation + * + * @author A. Ginaotto + * @version v6.0 + */ + public function updated($fields) + { + $this->validateOnly($fields); + + if (!is_null($fields) && !empty($fields)) { + $this->can_submit = true; + } else { + $this->can_submit = false; + } + + } + + /** + * Actually do the login thing + * + * @todo fix missing LDAP stuff maybe? + * @author A. Ginaotto + * @version v6.0 + */ + public function submitForm() + { + + $validatedData = $this->validate(); + + if (\Auth::attempt(array('username' => $this->username, 'password' => $this->password))){ + redirect()->route('dashboard'); + } else { + session()->flash('error', 'email and password are wrong.'); + } + + } + + +} diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 00b2ecbc60..95ae61e10a 100755 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -4,90 +4,6 @@ {{-- Page content --}} @section('content') -
- - - - - - -
-
- -
- - - -
- -
-
-
+@livewire('login-form') @stop diff --git a/resources/views/livewire/login-form.blade.php b/resources/views/livewire/login-form.blade.php new file mode 100644 index 0000000000..bc3efa3914 --- /dev/null +++ b/resources/views/livewire/login-form.blade.php @@ -0,0 +1,105 @@ +
+
+ + + + + + +
+
+ +
+ + + +
+ +
+
+
+ +
\ No newline at end of file