From 8dc01763bfee2daaa764e777a1a4c768cbc0441a Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 21 Feb 2024 11:29:08 +0200 Subject: [PATCH] add node settings username validation --- src/Controller/RoomController.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Controller/RoomController.php b/src/Controller/RoomController.php index e89cfb7..0ab8d49 100644 --- a/src/Controller/RoomController.php +++ b/src/Controller/RoomController.php @@ -1158,15 +1158,17 @@ class RoomController extends AbstractController return null; } + // Set default username + $user = $this->getParameter('app.add.user.name.anon'); + // Detect username (key @postfix) if (preg_match('/@([^@]+)$/', $data['key'], $match)) { - $user = $match[1]; - } - - else - { - $user = $this->getParameter('app.add.user.name.anon'); + // Set username on match node settings + if (preg_match($this->getParameter('app.add.user.name.regex'), $match[1])) + { + $user = $match[1]; + } } return (object)