Allow usernames to contain @-signs as long as it is not at the begininng

This allows to use email addresses as usernames and fixes issue #772
This commit is contained in:
Jan Böhmer 2024-12-01 23:05:27 +01:00
parent ca8ad760d7
commit b1ba26e0b9
3 changed files with 3 additions and 3 deletions

View file

@ -256,7 +256,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected ?string $password = null;
#[Assert\NotBlank]
#[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')]
#[Assert\Regex('/^[\w\.\+\-\$]+[\w\.\+\-\$\@]*$/', message: 'user.invalid_username')]
#[Groups(['user:read'])]
protected string $name = '';