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

Show time out of sync error #1094

Merged
merged 2 commits into from
Aug 22, 2023
Merged

Show time out of sync error #1094

merged 2 commits into from
Aug 22, 2023

Conversation

michael-markl
Copy link
Member

This should resolve #1065, #1056, #1049

When during self-verification, the time of the device is out of sync with the sever, the device would generate a wrong otp code and, thus, the server would respond that the card is not valid. The current app-store version (<= 3.1.3) of the app had the additional problem, that if the server responded once with "invalid", the app would not try to self-verify again the next time the app launches. This was already fixed by #1071 . This means, in the current dev-version (also before this PR), if you landed in this screen, resynced your local time, and restarted the app, the error would go away.

The solution I implemented here, is to simply analyze whether the time of the local device is out of sync at the time of self-verification. If so, we show a simple error like "Die Zeit deines Geräts scheint nicht zu stimmen. Synchronisiere deine Uhrzeit in den Geräte-Einstellungen."

Copy link
Contributor

@sarahsporck sarahsporck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You genius :) works like charm! Very nice 👍🏼

Comment on lines +80 to +83
ListTile(
title: const Text('Trigger self-verification'),
onTap: () => selfVerifyCard(userCodeModel, Configuration.of(context).projectId, client),
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already implemented in the 'eine andere Karte verifizieren' screen. However, I also see no pain in having it in another place as well :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the "eine andere Karte verifizieren", it does not trigger the same process. Here, it triggers the self-verification process which also persists the card verification

Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution. Just a small explanation about the outOfSync calculation would be awesome

@michael-markl
Copy link
Member Author

You genius :) works like charm! Very nice 👍🏼

Credit goes to @f1sh1918 for discovering that time-offset is the actual issue. :D Let's hope that this actually fixes all of the problems.

@f1sh1918
Copy link
Contributor

You genius :) works like charm! Very nice 👍🏼

Credit goes to @f1sh1918 for discovering that time-offset is the actual issue. :D Let's hope that this actually fixes all of the problems.

Hm not Sure if this also fixes the case when no activationTimestamp and totpSecret were written in the database but it's a super important fix :)

@michael-markl michael-markl merged commit b020867 into main Aug 22, 2023
@michael-markl michael-markl deleted the time-out-of-sync branch August 22, 2023 10:55
@michael-markl
Copy link
Member Author

Hm not Sure if this also fixes the case when no activationTimestamp and totpSecret were written in the database but it's a super important fix :)

True! I'm also not sure what happened there yet. That might actually be a different problem still :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants