Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-17354] feat: allow using non-numeric characters within PIN #4597

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ fun BitwardenUnlockWithPinSwitch(
onUnlockWithPinToggleAction(UnlockWithPinState.Disabled)
pin = ""
},
isPinCreation = true,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
* @param onCancelClick A callback for when the "Cancel" button is clicked.
* @param onSubmitClick A callback for when the "Submit" button is clicked.
* @param onDismissRequest A callback for when the dialog is requesting to be dismissed.
* @param isPinCreation A flag for determining if the dialog is being used for PIN creation. We
* want to restrict PINs to numeric values but also support any existing PINs with non-numeric
* characters.
*/
@OptIn(ExperimentalComposeUiApi::class)
@Suppress("LongMethod")
Expand All @@ -55,7 +52,6 @@ fun PinInputDialog(
onCancelClick: () -> Unit,
onSubmitClick: (String) -> Unit,
onDismissRequest: () -> Unit,
isPinCreation: Boolean = false,
) {
var pin by remember { mutableStateOf(value = "") }
Dialog(
Expand Down Expand Up @@ -112,10 +108,8 @@ fun PinInputDialog(
label = stringResource(id = R.string.pin),
value = pin,
autoFocus = true,
onValueChange = { newValue ->
pin = newValue.filter { it.isDigit() || !isPinCreation }
},
keyboardType = KeyboardType.Number,
onValueChange = { },
keyboardType = KeyboardType.Password,
textFieldTestTag = "AlertInputField",
cardStyle = CardStyle.Full,
modifier = Modifier.fillMaxWidth(),
Expand Down
Loading