U4-6306 - hostname validation issue
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
</thead>
|
||||
<tbody data-bind="foreach: domains">
|
||||
<tr>
|
||||
<td valign="top"><input class="domain" data-bind="value: Name, uniqueName: true" /><input type="hidden" value="0" /></td>
|
||||
<td valign="top"><input class="domain" data-bind="value: Name, uniqueName: true" /><input type="hidden" value="0" data-bind="uniqueName: true"/></td>
|
||||
<td valign="top"><select class="language" data-bind="options: $parent.languages, optionsText: 'Code', optionsValue: 'Id', value: Lang, uniqueName: true"></select></td>
|
||||
<td valign="top"><a href="#" class="btn btn-danger" data-bind="click: $parent.removeDomain"><i class="icon icon-trash"></i></a></td>
|
||||
</tr>
|
||||
|
||||
@@ -52,9 +52,15 @@
|
||||
ko.applyBindings(self);
|
||||
|
||||
$.validator.addMethod("domain", function (value, element, param) {
|
||||
// beware! encode('test') == 'test-'
|
||||
// read eg https://rt.cpan.org/Public/Bug/Display.html?id=94347
|
||||
value = punycode.encode(value);
|
||||
var re = /^(http[s]?:\/\/)?([-\w]+(\.[-\w]+)*)(:\d+)?(\/[-\w]*)?$/gi;
|
||||
return this.optional(element) || re.test(value);
|
||||
// that regex is best-effort and certainly not exact
|
||||
var re = /^(http[s]?:\/\/)?([-\w]+(\.[-\w]+)*)(:\d+)?(\/[-\w]*|-)?$/gi;
|
||||
var isopt = this.optional(element);
|
||||
var retest = re.test(value);
|
||||
var ret = isopt || retest;
|
||||
return ret;
|
||||
}, self._opts.invalidDomain);
|
||||
|
||||
$.validator.addMethod("duplicate", function (value, element, param) {
|
||||
@@ -85,7 +91,7 @@
|
||||
return false;
|
||||
|
||||
var mask = $('#komask');
|
||||
var masked = mask.next();
|
||||
var masked = mask.parent();
|
||||
mask.height(masked.height());
|
||||
mask.width(masked.width());
|
||||
mask.show();
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<tbody data-bind="foreach: domains">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<input class="domain" data-bind="value: Name, uniqueName: true" /><input type="hidden" value="0" /></td>
|
||||
<input class="domain" data-bind="value: Name, uniqueName: true" /><input type="hidden" value="0" data-bind="uniqueName: true"/></td>
|
||||
<td valign="top">
|
||||
<select class="language" data-bind="options: $parent.languages, optionsText: 'Code', optionsValue: 'Id', value: Lang, uniqueName: true"></select></td>
|
||||
<td valign="top"><a href="#" class="btn btn-danger" data-bind="click: $parent.removeDomain"><i class="icon icon-trash"></i></a></td>
|
||||
|
||||
Reference in New Issue
Block a user