]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: New dashboard user creation is successful with long characters > 256... 70361/head
authorDnyaneshwari Talwekar <dtalwekar@li-4c4c4544-0038-3510-8056-b5c04f473234.ibm.com>
Tue, 21 Jul 2026 05:36:26 +0000 (11:06 +0530)
committerDnyaneshwari Talwekar <dtalwekar@li-4c4c4544-0038-3510-8056-b5c04f473234.ibm.com>
Tue, 21 Jul 2026 12:12:50 +0000 (17:42 +0530)
Signed-off-by: Dnyaneshwari Talwekar <dtalweka@redhat.com>
Fixes: https://tracker.ceph.com/issues/78439
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts

index e0e28e9b23408273fc3563c743ccf653419fed54..d7c779eb1b4a0140bcbe60dab640107783ef7861 100644 (file)
@@ -32,6 +32,7 @@
             i18n-placeholder
             id="username"
             formControlName="username"
+            maxlength="256"
             [invalid]="!userForm.controls.username.valid && userForm.controls.username.dirty"
             autofocus
             ngbTooltip="White spaces at the beginning and end will be trimmed"
@@ -43,6 +44,9 @@
           <span *ngIf="userForm.showError('username', formDir, 'required')">
             <ng-container i18n> This field is required. </ng-container>
           </span>
+          <span *ngIf="userForm.showError('username', formDir, 'maxlength')">
+            <ng-container i18n> Username must not exceed 256 characters. </ng-container>
+          </span>
           <span *ngIf="userForm.showError('username', formDir, 'notUnique')">
             <ng-container i18n> The username already exists. </ng-container>
           </span>
index 12fb843692d7e659e07b1dc9486cdc49d9037174..e7b9c8ea9b5e56e7ad74d8f3408dc027b6fe8b66 100644 (file)
@@ -90,7 +90,11 @@ export class UserFormComponent extends CdForm implements OnInit {
       {
         username: [
           '',
-          [Validators.required, Validators.pattern(DASHBOARD_USERNAME_PATTERN)],
+          [
+            Validators.required,
+            Validators.pattern(DASHBOARD_USERNAME_PATTERN),
+            Validators.maxLength(256)
+          ],
           [CdValidators.unique(this.userService.validateUserName, this.userService)]
         ],
         name: [''],