mirror of
https://github.com/bitwarden/android.git
synced 2024-11-24 02:15:53 +03:00
PM-12733: Trim totp codes before saving them (#4315)
This commit is contained in:
parent
e90bd136f6
commit
ffeae93728
2 changed files with 2 additions and 3 deletions
|
@ -46,7 +46,7 @@ class ManualCodeEntryViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleCodeSubmit() {
|
private fun handleCodeSubmit() {
|
||||||
vaultRepository.emitTotpCodeResult(TotpCodeResult.Success(state.code))
|
vaultRepository.emitTotpCodeResult(TotpCodeResult.Success(state.code.trim()))
|
||||||
sendEvent(ManualCodeEntryEvent.NavigateBack)
|
sendEvent(ManualCodeEntryEvent.NavigateBack)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,7 @@ class ManualCodeEntryViewModelTests : BaseViewModelTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `CodeSubmit should emit new code and NavigateBack`() = runTest {
|
fun `CodeSubmit should emit new code and NavigateBack`() = runTest {
|
||||||
val viewModel =
|
val viewModel = createViewModel(initialState = ManualCodeEntryState(" TestCode "))
|
||||||
createViewModel(initialState = ManualCodeEntryState("TestCode"))
|
|
||||||
|
|
||||||
viewModel.eventFlow.test {
|
viewModel.eventFlow.test {
|
||||||
viewModel.trySendAction(ManualCodeEntryAction.CodeSubmit)
|
viewModel.trySendAction(ManualCodeEntryAction.CodeSubmit)
|
||||||
|
|
Loading…
Reference in a new issue