gluon-web-model: add hostname validator

This commit is contained in:
Ruben Barkow 2018-03-07 13:45:47 +01:00 committed by GitHub
parent 7e404ac517
commit c4e97d4c49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,6 +93,10 @@
return (v.length >= 8) && (v.length <= 63); return (v.length >= 8) && (v.length <= 63);
}, },
'hostname': function() {
return (this.match(/^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/i) != null);
},
'range': function(min, max) { 'range': function(min, max) {
var val = Dec(this); var val = Dec(this);
return (val >= +min && val <= +max); return (val >= +min && val <= +max);