mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-04 22:45:56 +01:00
Add proper length constraint validations to all string mapped ORM fields, so they show a nice validation error, instead of a 500 error
Fixes issue #544
This commit is contained in:
@@ -26,6 +26,7 @@ use App\Entity\Contracts\TimeStampableInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints\Length;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Webauthn\PublicKeyCredentialSource as BasePublicKeyCredentialSource;
|
||||
|
||||
@@ -43,6 +44,7 @@ class WebauthnKey extends BasePublicKeyCredentialSource implements TimeStampable
|
||||
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
#[NotBlank]
|
||||
#[Length(max: 255)]
|
||||
protected string $name = '';
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'webauthn_keys')]
|
||||
|
||||
Reference in New Issue
Block a user