diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 6a1f4d234ff..7f58e475af7 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -1342,7 +1342,6 @@ public function setPassword(string $password): DataResponse { /** * @PublicPage - * @UseSession * @BruteForceProtection(action=talkRoomPassword) * * @param string $token @@ -1483,7 +1482,6 @@ public function createGuestByDialIn(): DataResponse { /** * @PublicPage - * @UseSession * * @param string $token * @return DataResponse diff --git a/lib/TalkSession.php b/lib/TalkSession.php index 010e745f5e0..c5dc7bc5983 100644 --- a/lib/TalkSession.php +++ b/lib/TalkSession.php @@ -92,43 +92,32 @@ protected function getValues(string $key): array { protected function getValue(string $key, string $token): ?string { $values = $this->getValues($key); - - if (!isset($values[$token])) { - return null; - } - return $values[$token]; + return $values[$token] ?? null; } protected function setValue(string $key, string $token, string $value): void { - $values = $this->session->get($key); - if ($values === null) { - $values = []; - } else { - $values = json_decode($values, true); - if ($values === null) { - $values = []; - } - } - + $reopened = $this->session->reopen(); + $values = $this->getValues($key); $values[$token] = $value; $this->session->set($key, json_encode($values)); + + + if ($reopened) { + $this->session->close(); + } } protected function removeValue(string $key, string $token): void { - $values = $this->session->get($key); - if ($values === null) { - $values = []; - } else { - $values = json_decode($values, true); - if ($values === null) { - $values = []; - } else { - unset($values[$token]); - } - } + $reopened = $this->session->reopen(); + $values = $this->getValues($key); + unset($values[$token]); $this->session->set($key, json_encode($values)); + + if ($reopened) { + $this->session->close(); + } } public function renewSessionId(): void {