У меня есть эта проблема раньше, у меня есть этот способ решить, что, если вы хотите настроить его, вы можете рассмотреть этот способ.
В LoginController.php
вы можете добавить это немного кода, я перезаписываю метод входа по умолчанию:
public function login(Request $request)
{
$this->validateLogin($request);
$user = User::where($this->username(), $request->{$this->username()})->first();
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
if (method_exists($this, 'hasTooManyLoginAttempts') &&
$this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
if ($user->hasVerifiedEmail()) {
if ($this->attemptLogin($request)) {
return $this->sendLoginResponse($request);
}
})
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}
Вы также можете перезаписать и добавить новый параметр в sendFailedLoginResponse, чтобы метод знал, когда перенаправлять на страницу электронной почты / проверки, или просто добавить еще в $user->hasVerifiedEmail()
, если заблокировать в перенаправить его на электронную почту / подтвердить страницу
РЕДАКТИРОВАТЬ:
Вы можете удалить $this->middleware('guest')
в LoginController и RegisterController, чтобы войти в систему пользователь может go, чтобы зарегистрироваться и войти страницы, но это будет странно, если кто-то уже вошел в систему, может войти или зарегистрироваться снова.