]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Middleware/Authenticate.php
Cleaned tests up, Started LDAP tests, Created LDAP wrapper
[bookstack] / app / Http / Middleware / Authenticate.php
index 58b25ee3fc4cdaf84902dc9faf34e3a42e8734ee..ad804d0d86b15e16fb6c2bb6a553d7f4b29401ab 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 
-namespace Oxbow\Http\Middleware;
+namespace BookStack\Http\Middleware;
 
 use Closure;
 use Illuminate\Contracts\Auth\Guard;
+use BookStack\Exceptions\UserRegistrationException;
 use Setting;
 
 class Authenticate
@@ -34,8 +35,11 @@ class Authenticate
      */
     public function handle($request, Closure $next)
     {
-        $sitePublic = Setting::get('app-public', false) === 'true';
-        if ($this->auth->guest() && !$sitePublic) {
+        if(auth()->check() && auth()->user()->email_confirmed == false) {
+            return redirect()->guest('/register/confirm/awaiting');
+        }
+
+        if ($this->auth->guest() && !Setting::get('app-public')) {
             if ($request->ajax()) {
                 return response('Unauthorized.', 401);
             } else {