- relaxed checking of display name and authentication username

This commit is contained in:
Juha Heinanen
2018-12-20 08:39:47 +02:00
parent 8632df008a
commit d1ad8dc1ed
2 changed files with 4 additions and 4 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId = 'com.tutpro.baresip'
minSdkVersion 21
targetSdkVersion 27
versionCode = 39
versionName = '5.2.0'
versionCode = 40
versionName = '5.2.1'
externalNativeBuild {
cmake {
cFlags '-DHAVE_INTTYPES_H'

View File

@ -402,14 +402,14 @@ class AccountActivity : AppCompatActivity() {
private fun checkDisplayName(dn: String): Boolean {
if (dn == "") return true
val dnRegex = Regex("^[a-zA-Z]([ ._-]|[a-zA-Z0-9]){1,63}\$")
val dnRegex = Regex("^([* .!%_`'~]|[+]|[-a-zA-Z0-9]){1,63}\$")
return dnRegex.matches(dn)
}
private fun checkAuthUser(au: String): Boolean {
if (au == "") return true
val ud = au.split("@")
val userIDRegex = Regex("^[a-zA-Z]([._-]|[a-zA-Z0-9]){1,63}\$")
val userIDRegex = Regex("^([* .!%_`'~]|[+]|[-a-zA-Z0-9]){1,63}\$")
val telnoRegex = Regex("^[+]?[0-9]{1,16}\$")
if (ud.size == 1) {
return userIDRegex.matches(ud[0]) || telnoRegex.matches(ud[0])