bitwarden / mobile

Retired Bitwarden mobile app for iOS and Android (MAUI/Xamarin).
https://bitwarden.com
GNU General Public License v3.0
147 stars 24 forks source link

2FA / OTP code does not update when app is in background #3157

Open CAQEYdBeM6e6YSPE0S0mFzkn4jrOrmEgqqbrVuM opened 7 months ago

CAQEYdBeM6e6YSPE0S0mFzkn4jrOrmEgqqbrVuM commented 7 months ago

Steps To Reproduce

  1. Open Bitwarden, choose a login
  2. Go back to another app, such as web browser
  3. Wait about 30 seconds, so that OTP expires
  4. Go back to Bitwarden in the background

Expected Result

New OTP code should be displayed

Actual Result

Previous OTP code (when app was last put to background) is displayed

Screenshots or Videos

No response

Additional Context

After switching back to Bitwarden, if you wait until OTP expires (again), the refreshed OTP code is correct. A possible fix could be, force refreshing the OTP when app is "waken up(?)", since it's a lightweight operation

Operating System

iOS

Operating System Version

17.4.1

Device

iPhone 14

Build Version

2024.3.3 (7191)

Beta

NovaSilentium commented 7 months ago

Hi there,

I am unable to reproduce this issue, it has been escalated for further investigation. If you have more information that can help us, please add it below.

Thanks!

CAQEYdBeM6e6YSPE0S0mFzkn4jrOrmEgqqbrVuM commented 7 months ago

Hi there,

I am unable to reproduce this issue, it has been escalated for further investigation. If you have more information that can help us, please add it below.

Thanks!

https://github.com/bitwarden/mobile/assets/12783710/14dcbe9c-52f8-47ed-ba1e-5746adc4f8eb

Here is a screen recording of the problem

CAQEYdBeM6e6YSPE0S0mFzkn4jrOrmEgqqbrVuM commented 7 months ago

In the source, I see that OnDisappearing() event calls _vm.StopCiphersTotpTick() And LoadAsync() in CipherDetailsPageViewModel.cs calls TimerTask(..,StartCiphersTotpTick,..).RunPeriodic(); Not very experienced in Xamarin, but I think somewhere around LoadAsync() / timer creation or cancellation should be looked at, hope this helps!