add legacy usernames backport

This commit is contained in:
ghost 2023-12-18 22:20:47 +02:00
parent 8250a2f045
commit 8b1cb0acdd

View File

@ -825,7 +825,7 @@ class RoomController extends AbstractController
private function _post(array $data): ?object private function _post(array $data): ?object
{ {
// Validate key format allowed in settings // Validate key format allowed in settings
if (false === preg_match((string) $this->getParameter('app.add.post.key.regex'), $data['key'], $matches)) if (!preg_match((string) $this->getParameter('app.add.post.key.regex'), $data['key'], $matches))
{ {
return null; return null;
} }
@ -842,8 +842,14 @@ class RoomController extends AbstractController
return null; return null;
} }
// Legacy usernames backport
if (!preg_match((string) $this->getParameter('app.add.user.name.regex'), $matches[2]))
{
$matches[2] = 'anon';
}
// Validate value format allowed in settings // Validate value format allowed in settings
if (false === preg_match((string) $this->getParameter('app.add.post.value.regex'), $data['value'])) if (!preg_match((string) $this->getParameter('app.add.post.value.regex'), $data['value']))
{ {
return null; return null;
} }