]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Middleware/ApiAuthenticate.php
Fix English translations
[bookstack] / app / Http / Middleware / ApiAuthenticate.php
index 15962b3b00471d1fc55dd2a229824b50319886d6..728057bed175b42a880014b0ecfbd6c3962d2701 100644 (file)
@@ -35,9 +35,9 @@ class ApiAuthenticate
     {
         // Return if the user is already found to be signed in via session-based auth.
         // This is to make it easy to browser the API via browser after just logging into the system.
-        if (signedInUser()) {
+        if (signedInUser() || session()->isStarted()) {
             $this->ensureEmailConfirmedIfRequested();
-            if (!auth()->user()->can('access-api')) {
+            if (!user()->can('access-api')) {
                 throw new ApiAuthException(trans('errors.api_user_no_api_permission'), 403);
             }
             return;