X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/632ecc668ffe3e120a9bcc3d872dfd89be080629..refs/pull/691/head:/app/Http/Middleware/Authenticate.php diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 372f30bf6..c9b2726e8 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -4,8 +4,6 @@ namespace BookStack\Http\Middleware; use Closure; use Illuminate\Contracts\Auth\Guard; -use BookStack\Exceptions\UserRegistrationException; -use Setting; class Authenticate { @@ -32,8 +30,11 @@ class Authenticate */ public function handle($request, Closure $next) { - if ($this->auth->check() && setting('registration-confirmation') && !$this->auth->user()->email_confirmed) { - return redirect()->guest(baseUrl('/register/confirm/awaiting')); + if ($this->auth->check()) { + $requireConfirmation = (setting('registration-confirmation') || setting('registration-restrict')); + if ($requireConfirmation && !$this->auth->user()->email_confirmed) { + return redirect('/register/confirm/awaiting'); + } } if ($this->auth->guest() && !setting('app-public')) {