]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5523 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 12 Oct 2022 07:45:34 +0000 (09:45 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 12 Oct 2022 07:45:34 +0000 (09:45 +0200)
app/Services/WorkshopV2.php

index 46ed55d09d5a1b87f21f88670a18971169897c1e..714c1c062a7825cd2cf8abc1d9f3735ed36694d0 100644 (file)
@@ -4,6 +4,7 @@ namespace App\Services;
 
 use App\Models\User;
 use Cubist\Util\Files\Files;
+use Cubist\Util\Str;
 use Cubist\Util\Zip;
 use Exception;
 use GuzzleHttp\Client;
@@ -30,7 +31,12 @@ class WorkshopV2
     public function __construct($user)
     {
         $this->user = $user;
-        $this->_cookies = new FileCookieJar(Files::mkdir(protected_path('ws2cookies/')) . $this->user->id, true);
+        if (null !== $this->user) {
+            $cookie_id = $this->user->id;
+        } else {
+            $cookie_id = Str::random(5);
+        }
+        $this->_cookies = new FileCookieJar(Files::mkdir(protected_path('ws2cookies/')) . $cookie_id, true);
         $this->_http = new Client(['base_uri' => $this->_domain, 'timeout' => 60000, 'read_timeout' => 60000, 'cookies' => $this->_cookies]);
     }