-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 2FA login always shows generic "bad credentials" error #9
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,12 +182,15 @@ Future<Map<String, dynamic>?> _authenticateUntis({ | |
| }; | ||
| } | ||
|
|
||
| // Treat any server error as an invalid OTP when a code was provided, so | ||
| // the caller can show the 2FA-specific error instead of the generic | ||
| // "check your credentials" message. | ||
| final invalidOtp = | ||
| combined.contains('invalid otp') || | ||
| combined.contains('invalid verification') || | ||
| combined.contains('wrong otp') || | ||
| combined.contains('otp invalid') || | ||
| (contains2faHint && otpCode != null && otpCode.isNotEmpty); | ||
| (otpCode != null && otpCode.isNotEmpty); | ||
| if (invalidOtp) { | ||
|
Comment on lines
+185
to
194
|
||
| return { | ||
| 'otpInvalid': true, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the new
(otpCode != null && otpCode.isNotEmpty)clause, the preceding string checks ininvalidOtpare redundant for the OTP-present path (the expression will always be true). If the intent is “any error when OTP is provided”, this can be simplified to improve readability and avoid implying that keyword matching still matters in that branch.