Browse Source

add legacy usernames backport

main
ghost 11 months ago
parent
commit
8b1cb0acdd
  1. 10
      src/Controller/RoomController.php

10
src/Controller/RoomController.php

@ -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;
} }

Loading…
Cancel
Save