fix: set password on room creation

fix #85
pull/91/head
sualko 2020-09-28 15:05:52 +02:00
parent adc6a7437b
commit e1a6003e19
1 changed files with 4 additions and 0 deletions

View File

@ -79,6 +79,10 @@ class RoomService {
$room->setAccess($access); $room->setAccess($access);
$room->setUserId($userId); $room->setUserId($userId);
if ($access === Room::ACCESS_PASSWORD) {
$room->setPassword($this->humanReadableRandom(8));
}
$createdRoom = $this->mapper->insert($room); $createdRoom = $this->mapper->insert($room);
$this->eventDispatcher->dispatch(RoomCreatedEvent::class, new RoomCreatedEvent($createdRoom)); $this->eventDispatcher->dispatch(RoomCreatedEvent::class, new RoomCreatedEvent($createdRoom));