diff --git a/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt b/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt
index 695a80c5b4..9071197528 100644
--- a/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt
+++ b/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginScreen.kt
@@ -247,7 +247,7 @@ private fun TwoFactorLoginScreenContent(
Spacer(modifier = Modifier.height(height = 12.dp))
Text(
text = if (state.isNewDeviceVerification) {
- R.string.enter_verification_code_new_device.asText(state.displayEmail).invoke()
+ stringResource(R.string.enter_verification_code_new_device)
} else {
state.authMethod.description(
state.displayEmail,
diff --git a/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt b/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt
index 8dd82dd9d9..83f157c018 100644
--- a/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt
+++ b/app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt
@@ -190,12 +190,10 @@ class TwoFactorLoginViewModel @Inject constructor(
* Update the state with the new text and enable or disable the continue button.
*/
private fun handleCodeInputChanged(action: TwoFactorLoginAction.CodeInputChanged) {
- @Suppress("MagicNumber")
- val minLength = if (state.isNewDeviceVerification) 8 else 6
mutableStateFlow.update {
it.copy(
codeInput = action.input,
- isContinueButtonEnabled = action.input.length >= minLength,
+ isContinueButtonEnabled = action.input.isNotEmpty(),
)
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e257047fe7..5ac1860717 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -170,7 +170,7 @@
Authenticator app
Enter the 6 digit verification code from your authenticator app.
Enter the 6 digit verification code that was emailed to %1$s.
- We don\'t recognize this device. Enter the 8 digit verification code that was emailed to %1$s.
+ We don\'t recognize this device. Enter the code sent to your email to verify your identity.
Recovery code
Remember
Remember email
diff --git a/app/src/test/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModelTest.kt b/app/src/test/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModelTest.kt
index f35d0e0b75..36b3490fd4 100644
--- a/app/src/test/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModelTest.kt
+++ b/app/src/test/kotlin/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModelTest.kt
@@ -318,15 +318,14 @@ class TwoFactorLoginViewModelTest : BaseViewModelTest() {
@Test
@Suppress("MaxLineLength")
- fun `Continue buttons should only be enabled when code is 8 digit enough on isNewDeviceVerification`() {
- val initialState = DEFAULT_STATE.copy(isNewDeviceVerification = true)
- val viewModel = createViewModel(initialState)
- viewModel.trySendAction(TwoFactorLoginAction.CodeInputChanged("123456"))
+ fun `Continue buttons should only be enabled when code is not empty`() {
+ val viewModel = createViewModel()
+ viewModel.trySendAction(TwoFactorLoginAction.CodeInputChanged(""))
// 6 digit should be false when isNewDeviceVerification is true.
assertEquals(
- initialState.copy(
- codeInput = "123456",
+ DEFAULT_STATE.copy(
+ codeInput = "",
isContinueButtonEnabled = false,
),
viewModel.stateFlow.value,
@@ -335,7 +334,7 @@ class TwoFactorLoginViewModelTest : BaseViewModelTest() {
// Set it to true.
viewModel.trySendAction(TwoFactorLoginAction.CodeInputChanged("12345678"))
assertEquals(
- initialState.copy(
+ DEFAULT_STATE.copy(
codeInput = "12345678",
isContinueButtonEnabled = true,
),