Bind the tmpHash to the user id if logged-in
authorAlexander Ebert <ebert@woltlab.com>
Fri, 26 Apr 2024 11:24:27 +0000 (13:24 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 26 Apr 2024 11:24:27 +0000 (13:24 +0200)
files/lib/page/ConversationPage.class.php

index 2d4e67f7b257ee33dc82d94b4b41de3cc9b123dc..bcf262cc3af4847a743385e9b8858e89cb9b4f88 100644 (file)
@@ -326,12 +326,17 @@ class ConversationPage extends MultipleLinkPage
 
         MessageQuoteManager::getInstance()->assignVariables();
 
+        $identifier = WCF::getUser()->userID;
+        if ($identifier === 0) {
+            // Bind the tmpHash to the current session to make it unguessable.
+            $identifier = WCF::getSession()->sessionID;
+        }
+
         $tmpHash = \sha1(\implode("\0", [
             // Use class name + conversation ID to match the autosave scoping.
             self::class,
             $this->conversation->conversationID,
-            // Bind the tmpHash to the current session to make it unguessable.
-            WCF::getSession()->sessionID,
+            $identifier,
         ]));
         $attachmentHandler = new AttachmentHandler('com.woltlab.wcf.conversation.message', 0, $tmpHash, 0);