Skip to content

Commit

Permalink
fix(user management): required "group" field not well validated by fo…
Browse files Browse the repository at this point in the history
…rm (#9897)

In "Add user" form, "group" field was defined by default with an
impossible value. So form validator doesn't see issue if field was
not filled by customer. But customer was getting a strange error.

ref: MANAGER-12070

Signed-off-by: Vincent Cassé <[email protected]>
  • Loading branch information
VincentCasse authored Aug 28, 2023
1 parent b19864f commit c90138d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export default class UserAccountUsersAddCtrl {
this.alerter = Alerter;
this.$translate = $translate;
this.me = coreConfig.getUser();
this.user = {
group: 'REGULAR',
};
this.user = {};
this.groups = [];
this.loader = true;
this.PASSWORD_MIN_LENGTH = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@
</span>
</div>

<div class="form-group">
<div
class="form-group"
data-ng-class="{ 'has-error': $ctrl.userAccountUsersAddForm.group.$touched && $ctrl.userAccountUsersAddForm.group.$invalid }"
>
<label
class="control-label"
for="group"
Expand All @@ -156,6 +159,17 @@
data-ng-model="$ctrl.user.group"
>
</select>
<span
class="help-block"
role="alert"
data-ng-if="$ctrl.userAccountUsersAddForm.group.$touched"
data-ng-messages="$ctrl.userAccountUsersAddForm.group.$touched && $ctrl.userAccountUsersAddForm.group.$error"
>
<span
data-ng-message="required"
data-translate="user_users_add_required"
></span>
</span>
</div>

<div
Expand Down

0 comments on commit c90138d

Please sign in to comment.