]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Middleware/Authenticate.php
Update settings.php
[bookstack] / app / Http / Middleware / Authenticate.php
index a171a8a2d4c2b9219376d60fa82d2b2a71d48572..9a8affa8842fbe7e0a944462f5ee24770d752a79 100644 (file)
@@ -28,4 +28,22 @@ class Authenticate
 
         return $next($request);
     }
+
+    /**
+     * Provide an error response for when the current user's email is not confirmed
+     * in a system which requires it.
+     */
+    protected function emailConfirmationErrorResponse(Request $request)
+    {
+        if ($request->wantsJson()) {
+            return response()->json([
+                'error' => [
+                    'code' => 401,
+                    'message' => trans('errors.email_confirmation_awaiting')
+                ]
+            ], 401);
+        }
+
+        return redirect('/register/confirm/awaiting');
+    }
 }