diff options
author | Joas Schilling <coding@schilljs.com> | 2022-06-10 16:14:43 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-06-29 10:36:07 +0200 |
commit | 52cc89975c88a1f1e3ea2af8b4ca2b165df0b6bb (patch) | |
tree | 30667f96f30a43b47a4872796052214f2e3f5225 /lib/Room.php | |
parent | 2c3d71673b3ebccc9cbf008a0b86015442b4257c (diff) |
Implement password policy checker
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Room.php')
-rw-r--r-- | lib/Room.php | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/lib/Room.php b/lib/Room.php index a965dda8c..e022c938f 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -426,6 +426,10 @@ class Room { return $this->password; } + public function setPassword(string $password): void { + $this->password = $password; + } + public function getRemoteServer(): string { return $this->remoteServer; } @@ -693,32 +697,6 @@ class Room { } /** - * @param string $password Currently it is only allowed to have a password for Room::TYPE_PUBLIC - * @return bool True when the change was valid, false otherwise - */ - public function setPassword(string $password): bool { - if ($this->getType() !== self::TYPE_PUBLIC) { - return false; - } - - $hash = $password !== '' ? $this->hasher->hash($password) : ''; - - $event = new ModifyRoomEvent($this, 'password', $password); - $this->dispatcher->dispatch(self::EVENT_BEFORE_PASSWORD_SET, $event); - - $update = $this->db->getQueryBuilder(); - $update->update('talk_rooms') - ->set('password', $update->createNamedParameter($hash)) - ->where($update->expr()->eq('id', $update->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT))); - $update->executeStatement(); - $this->password = $hash; - - $this->dispatcher->dispatch(self::EVENT_AFTER_PASSWORD_SET, $event); - - return true; - } - - /** * @param \DateTime $now * @return bool */ |