remove domain-validator directive

we will replace with angular-tldjs
This commit is contained in:
Johannes Zellner
2017-02-09 17:27:18 +01:00
parent 56545b7f41
commit ff7ceb1442
2 changed files with 1 additions and 33 deletions

View File

@@ -470,35 +470,3 @@ app.directive('tagInput', function () {
'</div>'
};
});
app.directive('domainValidator', function() {
return {
// limit usage to argument only
restrict: 'A',
// require NgModelController, i.e. require a controller of ngModel directive
require: 'ngModel',
// create linking function and pass in our NgModelController as a 4th argument
link: function(scope, element, attr, ngModel) {
function validator(value) {
if (value.indexOf('.cloudron.') === -1 && /^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|([a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9]))\.([a-zA-Z]{2,6}|[a-zA-Z0-9-]{2,30}\.[a-zA-Z]{2,3})$/.test(value)) {
ngModel.$setValidity('invalidDomain', true);
} else {
ngModel.$setValidity('invalidDomain', false);
}
// we need to return our value, to be displayed to the user(value of the input)
return value ? value : undefined;
}
//For DOM -> model validation
ngModel.$parsers.unshift(validator);
//For model -> DOM validation
ngModel.$formatters.unshift(validator);
}
};
});

View File

@@ -11,7 +11,7 @@
<div class="form-group" ng-class="{ 'has-error': dnsCredentialsForm.customDomainId.$invalid }" uib-tooltip="{{ config.provider === 'caas' ? '' : 'Changing the domain is not yet supported' }}">
<label class="control-label" for="customDomainId">Domain name</label>
<input type="text" class="form-control" ng-model="dnsCredentials.customDomain" id="customDomainId" name="customDomainId" ng-disabled="dnsCredentials.busy || config.provider !== 'caas'" domain-validator placeholder="example.com" required autofocus>
<input type="text" class="form-control" ng-model="dnsCredentials.customDomain" id="customDomainId" name="customDomainId" ng-disabled="dnsCredentials.busy || config.provider !== 'caas'" placeholder="example.com" required autofocus>
</div>
<div class="form-group">