Small refactor for login Livewire
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
ca41e2b7f3
commit
c517ec849d
1 changed files with 17 additions and 18 deletions
|
@ -33,38 +33,37 @@ class LoginForm extends Component
|
||||||
*/
|
*/
|
||||||
public function updated($fields)
|
public function updated($fields)
|
||||||
{
|
{
|
||||||
$this->validateOnly($fields);
|
|
||||||
|
if (is_null($fields) || empty($fields)) {
|
||||||
if (!is_null($fields) && !empty($fields)) {
|
|
||||||
$this->can_submit = true;
|
|
||||||
} else {
|
|
||||||
$this->can_submit = false;
|
$this->can_submit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->validateOnly($fields);
|
||||||
|
|
||||||
|
$this->can_submit = true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actually do the login thing
|
* Actually do the login thing
|
||||||
*
|
*
|
||||||
* @todo fix missing LDAP stuff maybe?
|
* @todo fix missing LDAP stuff maybe? Not sure if it
|
||||||
|
* makes sense to even do this via LiveWire, since
|
||||||
|
* our login system is pretty complicated.
|
||||||
|
*
|
||||||
* @author A. Ginaotto <snipe@snipe.net>
|
* @author A. Ginaotto <snipe@snipe.net>
|
||||||
* @version v6.0
|
* @version v6.0
|
||||||
*/
|
*/
|
||||||
public function submitForm()
|
public function submitForm()
|
||||||
{
|
{
|
||||||
|
|
||||||
$validatedData = $this->validate();
|
$this->can_submit = true;
|
||||||
|
|
||||||
if (\Auth::attempt(
|
if (auth()->attempt($this->validate())) {
|
||||||
[
|
return redirect()->intended('/');
|
||||||
'username' => $this->username,
|
|
||||||
'password' => $this->password
|
|
||||||
]
|
|
||||||
))
|
|
||||||
{
|
|
||||||
redirect()->route('dashboard');
|
|
||||||
} else {
|
} else {
|
||||||
session()->flash('error', trans('auth/message.account_not_found'));
|
return session()->flash('error', trans('auth/message.account_not_found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue