Skip to content

Commit 22de0cd

Browse files
kari-tsbarnstar
andauthored
android: make custom url check case-insensitive (#513)
Fixes tailscale/corp#23210 Signed-off-by: kari-ts <[email protected]> Co-authored-by: Jonathan Nobels <[email protected]>
1 parent fc8ccc0 commit 22de0cd

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

android/src/main/java/com/tailscale/ipn/ui/view/CustomLogin.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Column
99
import androidx.compose.foundation.layout.PaddingValues
1010
import androidx.compose.foundation.layout.fillMaxWidth
1111
import androidx.compose.foundation.layout.padding
12+
import androidx.compose.foundation.text.KeyboardOptions
1213
import androidx.compose.material3.Button
1314
import androidx.compose.material3.ListItem
1415
import androidx.compose.material3.MaterialTheme
@@ -25,6 +26,7 @@ import androidx.compose.runtime.setValue
2526
import androidx.compose.ui.Modifier
2627
import androidx.compose.ui.graphics.Color
2728
import androidx.compose.ui.res.stringResource
29+
import androidx.compose.ui.text.input.KeyboardCapitalization
2830
import androidx.compose.ui.unit.dp
2931
import com.tailscale.ipn.R
3032
import com.tailscale.ipn.ui.theme.listItem
@@ -137,10 +139,12 @@ fun LoginView(
137139
onValueChange = { textVal = it },
138140
placeholder = {
139141
Text(strings.placeholder, style = MaterialTheme.typography.bodySmall)
140-
})
142+
},
143+
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.None)
144+
)
141145
})
142146

143-
ListItem(
147+
ListItem(
144148
colors = MaterialTheme.colorScheme.listItem,
145149
headlineContent = {
146150
Box(modifier = Modifier.fillMaxWidth()) {

android/src/main/java/com/tailscale/ipn/ui/viewModel/CustomLoginViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class LoginWithCustomControlURLViewModel : CustomLoginViewModel() {
3636
// localAPIClient will use the default server if we give it a broken URL,
3737
// but we can make sure we can construct a URL from the input string and
3838
// ensure it has an http/https scheme
39-
when (urlStr.startsWith("http") && urlStr.contains("://") && urlStr.length > 7) {
39+
when (urlStr.startsWith("http", ignoreCase = true) &&
40+
urlStr.contains("://") &&
41+
urlStr.length > 7) {
4042
false -> {
4143
errorDialog.set(ErrorDialogType.INVALID_CUSTOM_URL)
4244
return

0 commit comments

Comments
 (0)