Skip to content

Commit

Permalink
fix - ensure login step catches incorrectly entered 2FA (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
mormaer authored Sep 14, 2023
1 parent 124e914 commit 5e95c0b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Mlem/API/Models/APIErrorResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ private let possibleCredentialErrors = [
"couldnt_find_that_username_or_email"
]

private let possible2FAErrors = [
"missing_totp_token",
"incorrect_totp_token"
]

extension APIErrorResponse {
var isIncorrectLogin: Bool { possibleCredentialErrors.contains(error) }
var requires2FA: Bool { error == "missing_totp_token" }
var requires2FA: Bool { possible2FAErrors.contains(error) }
var isNotLoggedIn: Bool { error == "not_logged_in" }
}

0 comments on commit 5e95c0b

Please sign in to comment.