Fix form validation for external domains

This commit is contained in:
Johannes Zellner
2017-05-03 15:25:24 +02:00
parent be5221d5b8
commit 3e6295de92
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -8,9 +8,9 @@ angular.module('ngTld', [])
.directive('checkTld', checkTld);
function ngTld() {
function tldExists(path) {
function isValid(path) {
// https://github.com/oncletom/tld.js/issues/58
return (path.slice(-1) !== '.') && path === tld.getDomain(path);
return (path.slice(-1) !== '.') && tld.isValid(path);
}
function isSubdomain(path) {
@@ -22,7 +22,7 @@ function ngTld() {
}
return {
tldExists: tldExists,
isValid: isValid,
isSubdomain: isSubdomain,
isNakedDomain: isNakedDomain
};