Skip to content

Commit

Permalink
[5.4] MCAS-6: Validate special character not allowed (#561)
Browse files Browse the repository at this point in the history
* feat: validate un supported char for password

* feat: show appropiate error message

* feat: validate symbol when edit user

* chore: single regex rule
  • Loading branch information
masmerino13 authored Dec 23, 2024
1 parent 3a30e21 commit f6d8a9b
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions submodules/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ define(function(require) {
'meta': 'apps'
},

rules: {
password: {
// NOTE: This regex is used to prevent the user from entering a password with a square bracket
regex: /^[^[]+$/
}
},

/* Users */
/* args: parent and userId */
usersRender: function(args) {
Expand Down Expand Up @@ -1098,12 +1105,18 @@ define(function(require) {
},
password: {
required: true,
minlength: 6
minlength: 6,
regex: self.rules.password.regex
},
confirm_password: {
required: true,
equalTo: '#inputPassword'
}
},
messages: {
'password': {
regex: self.i18n.active().validation.defaultRules.passwordCharacter
}
}
});

Expand Down Expand Up @@ -1863,7 +1876,8 @@ define(function(require) {
checkList: originalData.listVMBoxes
},
'user.password': {
minlength: 6
minlength: 6,
regex: self.rules.password.regex
},
'user.device.name': 'required',
'user.device.model': 'required',
Expand All @@ -1890,6 +1904,9 @@ define(function(require) {
},
'user.device.mac_address': {
required: self.i18n.active().validation.required
},
'user.password': {
regex: self.i18n.active().validation.defaultRules.passwordCharacter
}
}
};
Expand Down

0 comments on commit f6d8a9b

Please sign in to comment.