mirror of https://github.com/apache/cloudstack.git
cloudStack 3.0 UI - validation - add new method "disallowSpecialCharacters" which will disallow < and > (to prevent XSS attack) - apply this method in Add Domain dialog.
This commit is contained in:
parent
125a156485
commit
9d1d77ea77
|
|
@ -172,11 +172,11 @@
|
|||
fields: {
|
||||
name: {
|
||||
label: 'label.name',
|
||||
validation: { required: true }
|
||||
validation: { required: true, disallowSpecialCharacters: true }
|
||||
},
|
||||
networkdomain: {
|
||||
label: 'label.network.domain',
|
||||
validation: { required: false }
|
||||
validation: { required: false, disallowSpecialCharacters: true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,6 +273,14 @@
|
|||
|
||||
// Validation
|
||||
$.extend($.validator.messages, { required: _l('label.required') });
|
||||
|
||||
$.validator.addMethod(
|
||||
"disallowSpecialCharacters",
|
||||
function(value, element) {
|
||||
return (value.indexOf("<") == -1 && value.indexOf(">") == -1);
|
||||
},
|
||||
jQuery.format("Disallowed characters: <, >")
|
||||
);
|
||||
|
||||
// Check for pending project invitations
|
||||
cloudStack.projects.invitationCheck({
|
||||
|
|
|
|||
Loading…
Reference in New Issue