Skip to content

Commit c1102fc

Browse files
committed
Add disallowSpecialCharacters to some fields
1 parent fcf111d commit c1102fc

7 files changed

Lines changed: 16 additions & 7 deletions

File tree

client/WEB-INF/classes/resources/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ label.disk.iops.min=Min IOPS
2222
label.disk.iops.max=Max IOPS
2323
label.disk.iops.total=IOPS Total
2424
label.view.secondary.ips=View secondary IPs
25+
message.validate.invalid.characters=Invalid characters found; please correct.
2526
message.acquire.ip.nic=Please confirm that you would like to acquire a new secondary IP for this NIC.<br/>NOTE: You need to manually configure the newly-acquired secondary IP inside the virtual machine.
2627
message.select.affinity.groups=Please select any affinity groups you want this VM to belong to:
2728
message.no.affinity.groups=You do not have any affinity groups. Please continue to the next step.

ui/dictionary.jsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ under the License.
2525
<% long now = System.currentTimeMillis(); %>
2626
<script language="javascript">
2727
dictionary = {
28+
'message.validate.invalid.characters': '<fmt:message key="message.validate.invalid.characters" />',
2829
'label.about': '<fmt:message key="label.about" />',
2930
'label.about.app': '<fmt:message key="label.about.app" />',
3031
'label.app.name': '<fmt:message key="label.app.name" />',

ui/index.jsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ under the License.
298298
<div class="field name hide-if-unselected">
299299
<div class="name"> <span class="field-required">*</span> <fmt:message key="label.name"/></div>
300300
<div class="value">
301-
<input type="text" class="required" name="new-network-name" />
301+
<input type="text" class="required disallowSpecialCharacters" name="new-network-name" />
302302
</div>
303303
</div>
304304

@@ -348,7 +348,7 @@ under the License.
348348
<span><fmt:message key="label.name"/> (<fmt:message key="label.optional"/>)</span>
349349
</div>
350350
<div class="value">
351-
<input type="text" name="displayname" />
351+
<input type="text" name="displayname" class="disallowSpecialCharacters" />
352352
</div>
353353
</div>
354354
<!-- Add to group -->
@@ -357,7 +357,7 @@ under the License.
357357
<span><fmt:message key="label.add.to.group"/> (<fmt:message key="label.optional"/>)</span>
358358
</div>
359359
<div class="value">
360-
<input type="text" name="groupname" />
360+
<input type="text" name="groupname" class="disallowSpecialCharacters" />
361361
</div>
362362
</div>
363363
<!-- Zone -->

ui/scripts/ui-custom/zoneWizard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@
588588
$('<div>').addClass('value').append(
589589
$('<input>').attr({
590590
type: 'text'
591-
}).addClass('required')
591+
}).addClass('required disallowSpecialCharacters')
592592
)
593593
);
594594

ui/scripts/ui/widgets/detailView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@
588588
type: 'text',
589589
value: data
590590
})
591-
.data('original-value', data)
591+
.addClass('disallowSpecialCharacters').data('original-value', data)
592592
);
593593

594594
// Make option values from given array
@@ -617,7 +617,7 @@
617617
name: name,
618618
type: 'text',
619619
value: data
620-
}).data('original-value', data)
620+
}).addClass('disallowSpecialCharacters').data('original-value', data)
621621
);
622622
}
623623

ui/scripts/ui/widgets/listView.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,11 @@
529529
if (!$editInput.is(':visible') || !(typeof(args.action) == 'undefined')) { //click Edit button
530530
showEditField();
531531
} else if ($editInput.val() != $label.html()) { //click Save button with changed value
532+
if ($editInput.val().match(/<|>/)) {
533+
cloudStack.dialog.notice({ message: 'message.validate.invalid.characters' });
534+
return false;
535+
}
536+
532537
$edit.animate({
533538
opacity: 0.5
534539
});

ui/scripts/ui/widgets/multiEdit.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@
918918

919919
$(field.range).each(function() { //e.g. field.range = ['privateport', 'privateendport'];
920920
var $input = $('<input>')
921+
.addClass('disallowSpecialCharacters')
921922
.attr({
922923
name: this,
923924
type: 'text'
@@ -941,7 +942,8 @@
941942
name: fieldName,
942943
type: field.isPassword ? 'password' : 'text'
943944
})
944-
.addClass(!field.isOptional ? 'required' : null)
945+
.addClass(!field.isOptional ? 'required' : null)
946+
.addClass('disallowSpecialCharacters')
945947
.attr('disabled', field.isDisabled ? 'disabled' : false)
946948
.appendTo($td);
947949

0 commit comments

Comments
 (0)