From 374e7a7796dad4a1257a975b3ac966a0cca6e8d4 Mon Sep 17 00:00:00 2001 From: Dnyaneshwari Talwekar Date: Tue, 21 Jul 2026 11:06:26 +0530 Subject: [PATCH] mgr/dashboard: New dashboard user creation is successful with long characters > 256 but login fails Signed-off-by: Dnyaneshwari Talwekar Fixes: https://tracker.ceph.com/issues/78439 --- .../src/app/core/auth/user-form/user-form.component.html | 4 ++++ .../src/app/core/auth/user-form/user-form.component.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html index e0e28e9b2340..d7c779eb1b4a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.html @@ -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 @@ This field is required. + + Username must not exceed 256 characters. + The username already exists. diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts index 12fb843692d7..e7b9c8ea9b5e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.ts @@ -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: [''], -- 2.47.3