add node settings username validation

This commit is contained in:
ghost 2024-02-21 11:29:08 +02:00
parent ed9b29da14
commit 8dc01763bf

View File

@ -1158,15 +1158,17 @@ class RoomController extends AbstractController
return null; return null;
} }
// Set default username
$user = $this->getParameter('app.add.user.name.anon');
// Detect username (key @postfix) // Detect username (key @postfix)
if (preg_match('/@([^@]+)$/', $data['key'], $match)) if (preg_match('/@([^@]+)$/', $data['key'], $match))
{
// Set username on match node settings
if (preg_match($this->getParameter('app.add.user.name.regex'), $match[1]))
{ {
$user = $match[1]; $user = $match[1];
} }
else
{
$user = $this->getParameter('app.add.user.name.anon');
} }
return (object) return (object)