3 namespace BookStack\Exceptions;
5 use BookStack\Auth\Access\LoginService;
6 use BookStack\Auth\User;
7 use Illuminate\Contracts\Support\Responsable;
9 class StoppedAuthenticationException extends \Exception implements Responsable
13 protected $loginService;
16 * StoppedAuthenticationException constructor.
18 public function __construct(User $user, LoginService $loginService)
21 $this->loginService = $loginService;
22 parent::__construct();
28 public function toResponse($request)
32 if ($this->loginService->awaitingEmailConfirmation($this->user)) {
33 $redirect = '/register/confirm/awaiting';
34 } else if ($this->loginService->needsMfaVerification($this->user)) {
35 $redirect = '/mfa/verify';
38 return redirect($redirect);