Skip to content

Commit

Permalink
Reuse FIRAuthErrorCodeInvalidCredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
renkelvin committed Nov 15, 2023
1 parent 81daeb2 commit 6ec29fa
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 21 deletions.
8 changes: 2 additions & 6 deletions FirebaseAuth/Sources/Backend/FIRAuthBackend.m
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,8 @@ + (nullable NSError *)clientErrorWithServerErrorMessage:(NSString *)serverErrorM
}

if ([shortErrorMessage isEqualToString:kInvalidCredentialErrorMessage] ||
[shortErrorMessage isEqualToString:kInvalidPendingToken]) {
[shortErrorMessage isEqualToString:kInvalidPendingToken] ||
[shortErrorMessage isEqualToString:kInvalidLoginCredentials]) {
return [FIRAuthErrorUtils invalidCredentialErrorWithMessage:serverDetailErrorMessage];
}

Expand Down Expand Up @@ -1647,11 +1648,6 @@ + (nullable NSError *)clientErrorWithServerErrorMessage:(NSString *)serverErrorM
message:serverErrorMessage];
}

if ([shortErrorMessage isEqualToString:kInvalidLoginCredentials]) {
return [FIRAuthErrorUtils errorWithCode:FIRAuthInternalErrorCodeInvalidLoginCredentials
message:serverErrorMessage];
}

// In this case we handle an error that might be specified in the underlying errors dictionary,
// the error message in determined based on the @c reason key in the dictionary.
if (errorDictionary[kErrorsKey]) {
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ NS_SWIFT_NAME(Auth)
/** @fn signInWithEmail:password:completion:
@brief Signs in using an email address and password. When [Email Enumeration
Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)
is enabled, this method fails with FIRAuthErrorCodeInvalidLoginCredentials in case of an invalid
is enabled, this method fails with FIRAuthErrorCodeInvalidCredentials in case of an invalid
email/password.
@param email The user's email address.
Expand Down
4 changes: 0 additions & 4 deletions FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuthErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,6 @@ typedef NS_ERROR_ENUM(FIRAuthErrorDomain, FIRAuthErrorCode){
*/
FIRAuthErrorCodeRecaptchaSDKNotLinked = 17208,

/** Indicates that the login credentials is invalid.
*/
FIRAuthErrorCodeInvalidLoginCredentials = 17213,

/** Indicates an error occurred while attempting to access the keychain.
*/
FIRAuthErrorCodeKeychainError = 17995,
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAuth/Sources/Public/FirebaseAuth/FIRUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ NS_SWIFT_NAME(User)

/** @fn updateEmail:completion:
@brief Updates the email address for the user. On success, the cached user profile data is
updated. Throws FIRAuthErrorCodeInvalidLoginCredentials error when [Email Enumeration
updated. Throws FIRAuthErrorCodeInvalidCredentials error when [Email Enumeration
Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)
is enabled.
@remarks May fail if there is already an account with this email address that was created using
Expand Down
4 changes: 0 additions & 4 deletions FirebaseAuth/Sources/Utilities/FIRAuthErrorUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,6 @@
return kFIRAuthErrorMessageInvalidReqType;
case FIRAuthErrorCodeRecaptchaSDKNotLinked:
return kFIRAuthErrorMessageRecaptchaSDKNotLinked;
case FIRAuthErrorCodeInvalidLoginCredentials:
return kFIRAuthErrorMessageInvalidLoginCredentials;
}
}

Expand Down Expand Up @@ -1003,8 +1001,6 @@
return @"ERROR_INVALID_REQ_TYPE";
case FIRAuthErrorCodeRecaptchaSDKNotLinked:
return @"ERROR_RECAPTCHA_SDK_NOT_LINKED";
case FIRAuthErrorCodeInvalidLoginCredentials:
return @"ERROR_INVALID_LOGIN_CREDENTIALS";
}
}

Expand Down
5 changes: 0 additions & 5 deletions FirebaseAuth/Sources/Utilities/FIRAuthInternalErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,6 @@ typedef NS_ENUM(NSInteger, FIRAuthInternalErrorCode) {
FIRAuthInternalErrorCodeRecaptchaNotEnabled = FIRAuthPublicErrorCodeFlag |
FIRAuthErrorCodeRecaptchaNotEnabled,

/** Indicates that the login credentials is invalid.
*/
FIRAuthInternalErrorCodeInvalidLoginCredentials = FIRAuthPublicErrorCodeFlag |
FIRAuthErrorCodeInvalidLoginCredentials,

/** Indicates that the recaptcha sdk is not linked to the app.
*/
FIRAuthInternalErrorCodeRecaptchaSDKNotLinked = FIRAuthPublicErrorCodeFlag |
Expand Down

0 comments on commit 6ec29fa

Please sign in to comment.