Эх сурвалжийг харах

fix 不允许输入错误的端口号

robin 4 жил өмнө
parent
commit
c7c0562e4b

+ 1 - 1
app/src/main/java/com/doverfuelingsolutions/issp/utils/ValidateUtil.kt

@@ -13,6 +13,6 @@ class ValidateUtil {
         fun isPositiveInt(num: String): Boolean = regexPositiveInt.matches(num)
         fun isPositiveInt(num: String): Boolean = regexPositiveInt.matches(num)
         fun isUrl(url: String): Boolean = regexUrl.matches(url)
         fun isUrl(url: String): Boolean = regexUrl.matches(url)
         fun isIPHost(url: String): Boolean = regexIPHost.matches(url)
         fun isIPHost(url: String): Boolean = regexIPHost.matches(url)
-        fun isPort(port: String): Boolean = isPositiveInt(port) && port.toInt() < 65535
+        fun isPort(port: String): Boolean = isPositiveInt(port) && port.length < 6 && port.toInt() < 65535
     }
     }
 }
 }