Skip to content

Commit

Permalink
fix(auth): use correct code on network exception (#3655)
Browse files Browse the repository at this point in the history
Fixes #3654.

[publish]
  • Loading branch information
Salakar authored May 15, 2020
1 parent 75d2207 commit 8bcf5c9
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseException;
import com.google.firebase.FirebaseNetworkException;
import com.google.firebase.auth.ActionCodeResult;
import com.google.firebase.auth.ActionCodeSettings;
import com.google.firebase.auth.AuthCredential;
Expand Down Expand Up @@ -1773,9 +1774,13 @@ private WritableMap getJSError(Exception exception) {
}
}

if (code.equals("UNKNOWN") && exception instanceof FirebaseAuthInvalidCredentialsException) {
code = "INVALID_EMAIL";
message = invalidEmail;
if (code.equals("UNKNOWN")) {
if (exception instanceof FirebaseAuthInvalidCredentialsException) {
code = "INVALID_EMAIL";
message = invalidEmail;
} else if (exception instanceof FirebaseNetworkException) {
code = "NETWORK_REQUEST_FAILED";
}
}

code = code
Expand Down Expand Up @@ -1910,7 +1915,7 @@ private WritableMap firebaseUserToMap(FirebaseUser user) {

private ActionCodeSettings buildActionCodeSettings(ReadableMap actionCodeSettings) {
ActionCodeSettings.Builder builder = ActionCodeSettings.newBuilder();

// Required
String url = actionCodeSettings.getString("url");
builder = builder.setUrl(Objects.requireNonNull(url));
Expand Down

0 comments on commit 8bcf5c9

Please sign in to comment.