From 471ccfc804dbf20cc3605ddeb27ffe6fdf31d4ca Mon Sep 17 00:00:00 2001 From: Pedro Gonzalez Gomez Date: Wed, 6 Jul 2022 11:51:17 +0200 Subject: [PATCH] mgr/dashboard: added pattern validaton for form input Fixes: https://tracker.ceph.com/issues/56133 Signed-off-by: Pedro Gonzalez Gomez (cherry picked from commit ec688a96d32eac8185351ff8bf3239131b083423) --- .../app/ceph/rgw/rgw-user-form/rgw-user-form.component.html | 3 +++ .../src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html index 4a28c3e57234b..6c00f37d42d83 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html @@ -82,6 +82,9 @@ class="form-control" type="text" formControlName="display_name"> + The value is not valid. This field is required. diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts index 5ab3337717812..9d4e1ce601b7f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts @@ -98,7 +98,7 @@ export class RgwUserFormComponent extends CdForm implements OnInit { ) ] ], - display_name: [null, [Validators.required]], + display_name: [null, [Validators.required, Validators.pattern(/^[a-zA-Z0-9!@#%^&*()_ -]+$/)]], email: [ null, [CdValidators.email], -- 2.39.5