loginService->awaitingEmailConfirmation($this->user)) { return $this->awaitingEmailConfirmationResponse($request); } if ($this->loginService->needsMfaVerification($this->user)) { $redirect = '/mfa/verify'; } return redirect($redirect); } /** * Provide an error response for when the current user's email is not confirmed * in a system which requires it. */ protected function awaitingEmailConfirmationResponse(Request $request) { if ($request->wantsJson()) { return response()->json([ 'error' => [ 'code' => 401, 'message' => trans('errors.email_confirmation_awaiting'), ], ], 401); } if (session()->pull('sent-email-confirmation') === true) { return redirect('/register/confirm'); } return redirect('/register/confirm/awaiting'); } }