This repository was archived by the owner on Feb 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ sealed interface Nonce {
1919 enum class CookieNonceErrorType {
2020 NOT_AUTHENTICATED ,
2121 INVALID_RESPONSE ,
22+ INVALID_CREDENTIALS ,
2223 CUSTOM_LOGIN_URL ,
2324 CUSTOM_ADMIN_URL ,
2425 INVALID_NONCE ,
25- CAPTCHA_ERROR ,
2626 GENERIC_ERROR ,
2727 UNKNOWN
2828 }
Original file line number Diff line number Diff line change @@ -69,11 +69,18 @@ class NonceRestClient @Inject constructor(
6969 // that it's an authentication issue, otherwise we'll assume it's an invalid response
7070 val errorMessage = extractErrorMessage(response.data.orEmpty())
7171
72+ val errorType = if (hasInvalidCredentialsPattern(response.data.orEmpty())) {
73+ Nonce .CookieNonceErrorType .INVALID_CREDENTIALS
74+ } else if (errorMessage != null ) {
75+ Nonce .CookieNonceErrorType .NOT_AUTHENTICATED
76+ } else {
77+ Nonce .CookieNonceErrorType .INVALID_RESPONSE
78+ }
79+
7280 FailedRequest (
7381 timeOfResponse = currentTimeProvider.currentDate().time,
7482 username = username,
75- type = if (errorMessage != null ) Nonce .CookieNonceErrorType .NOT_AUTHENTICATED
76- else Nonce .CookieNonceErrorType .INVALID_RESPONSE ,
83+ type = errorType,
7784 errorMessage = errorMessage
7885 )
7986 }
You can’t perform that action at this time.
0 commit comments