Skip to content

Commit

Permalink
Use password keyboard type for inputs in PasswordDialog
Browse files Browse the repository at this point in the history
This disables dictionary and autocorrect for password inputs, which could leak entered passwords. Fixes twofas#152
  • Loading branch information
prokoma committed Sep 8, 2024
1 parent db17645 commit 2077e9f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
Expand All @@ -36,7 +37,9 @@ fun PasswordDialog(
onPositive: ((String) -> Unit)? = null,
onNegative: (() -> Unit)? = null,
validation: ((String) -> Boolean)? = null,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default.copy(
keyboardType = KeyboardType.Password,
),
minLength: Int = 3,
maxLength: Int = Int.MAX_VALUE,
confirmRequired: Boolean = true,
Expand Down Expand Up @@ -118,4 +121,4 @@ private fun Preview() {
title = "Password",
body = TwLocale.strings.placeholderMedium,
)
}
}

0 comments on commit 2077e9f

Please sign in to comment.