]> BookStack Code Mirror - bookstack/blobdiff - app/Users/Controllers/UserApiController.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / app / Users / Controllers / UserApiController.php
index 6ee8f16d15ed317de5dcdaa4748e07610b1da4b7..bb2570b3108bfe34131850465067b2f51fc7842c 100644 (file)
@@ -33,11 +33,11 @@ class UserApiController extends ApiController
         });
     }
 
-    protected function rules(int $userId = null): array
+    protected function rules(?int $userId = null): array
     {
         return [
             'create' => [
-                'name'  => ['required', 'string', 'min:2', 'max:100'],
+                'name'  => ['required', 'string', 'min:1', 'max:100'],
                 'email' => [
                     'required', 'string', 'email', 'min:2', new Unique('users', 'email'),
                 ],
@@ -49,12 +49,12 @@ class UserApiController extends ApiController
                 'send_invite'      => ['boolean'],
             ],
             'update' => [
-                'name'  => ['string', 'min:2', 'max:100'],
+                'name'  => ['string', 'min:1', 'max:100'],
                 'email' => [
                     'string',
                     'email',
                     'min:2',
-                    (new Unique('users', 'email'))->ignore($userId ?? null),
+                    (new Unique('users', 'email'))->ignore($userId),
                 ],
                 'external_auth_id' => ['string'],
                 'language'         => ['string', 'max:15', 'alpha_dash'],