Redirect to home site if user is already logged in

2022-03-24
Luca 3 years ago
parent 52e8c895cb
commit c9fa7131bd

@ -62,7 +62,11 @@ class AuthController extends BaseController
*/ */
public function login(): Response public function login(): Response
{ {
return !$this->auth->user() ? $this->showLogin() : $this->redirect->to($this->config->get('home_site')); if ($this->auth->user()) {
return $this->redirect->to($this->config->get('home_site'));
}
return $this->showLogin();
} }
/** /**
@ -84,6 +88,10 @@ class AuthController extends BaseController
*/ */
public function postLogin(Request $request): Response public function postLogin(Request $request): Response
{ {
if ($this->auth->user()) {
return $this->redirect->to($this->config->get('home_site'));
}
$data = $this->validate($request, [ $data = $this->validate($request, [
'login' => 'required', 'login' => 'required',
'password' => 'required', 'password' => 'required',

Loading…
Cancel
Save