mirror of
https://github.com/bitwarden/android.git
synced 2026-05-21 11:56:35 -05:00
BIT-1451, BIT-1453: logout on failed attempts (#833)
This commit is contained in:
committed by
Álison Fernandes
parent
b3fa33a02c
commit
a88f28e5bc
@@ -125,8 +125,7 @@ class VaultUnlockViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
private fun handleBiometricsLockOut() {
|
||||
// TODO: Handle biometrics lockout (BIT-1451)
|
||||
sendEvent(VaultUnlockEvent.ShowToast("Lock out not yet implemented".asText()))
|
||||
authRepository.logout()
|
||||
}
|
||||
|
||||
private fun handleBiometricsUnlockClick() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.x8bit.bitwarden.ui.auth.feature.vaultunlock
|
||||
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import app.cash.turbine.test
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.data.auth.datasource.disk.model.EnvironmentUrlDataJson
|
||||
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
|
||||
@@ -529,15 +528,14 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on BiometricsLockOut should emit ShowToast`() = runTest {
|
||||
fun `on BiometricsLockOut should log the current user out`() = runTest {
|
||||
every { authRepository.logout() } just runs
|
||||
val viewModel = createViewModel()
|
||||
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.trySendAction(VaultUnlockAction.BiometricsLockOut)
|
||||
assertEquals(
|
||||
VaultUnlockEvent.ShowToast("Lock out not yet implemented".asText()),
|
||||
awaitItem(),
|
||||
)
|
||||
viewModel.trySendAction(VaultUnlockAction.BiometricsLockOut)
|
||||
|
||||
verify(exactly = 1) {
|
||||
authRepository.logout()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user