|
1 | 1 | package com.firebase.ui.auth.viewmodel.email;
|
2 | 2 |
|
3 | 3 | import android.app.Application;
|
| 4 | +import android.util.Log; |
4 | 5 |
|
| 6 | +import com.firebase.ui.auth.ErrorCodes; |
| 7 | +import com.firebase.ui.auth.FirebaseUiException; |
5 | 8 | import com.firebase.ui.auth.IdpResponse;
|
6 | 9 | import com.firebase.ui.auth.data.model.IntentRequiredException;
|
7 | 10 | import com.firebase.ui.auth.data.model.Resource;
|
|
23 | 26 | import com.google.firebase.auth.FirebaseAuthUserCollisionException;
|
24 | 27 |
|
25 | 28 | import androidx.annotation.NonNull;
|
| 29 | +import androidx.annotation.Nullable; |
26 | 30 | import androidx.annotation.RestrictTo;
|
27 | 31 |
|
28 | 32 | import static com.firebase.ui.auth.AuthUI.EMAIL_LINK_PROVIDER;
|
@@ -70,6 +74,8 @@ public void onFailure(@NonNull Exception e) {
|
70 | 74 | password);
|
71 | 75 | handleMergeFailure(credential);
|
72 | 76 | } else {
|
| 77 | + Log.w(TAG, "Got a collision error during a non-upgrade flow", e); |
| 78 | + |
73 | 79 | // Collision with existing user email without anonymous upgrade
|
74 | 80 | // it should be very hard for the user to even get to this error
|
75 | 81 | // due to CheckEmailFragment.
|
@@ -97,10 +103,14 @@ public StartWelcomeBackFlow(String email) {
|
97 | 103 | }
|
98 | 104 |
|
99 | 105 | @Override
|
100 |
| - public void onSuccess(String provider) { |
| 106 | + public void onSuccess(@Nullable String provider) { |
101 | 107 | if (provider == null) {
|
102 |
| - throw new IllegalStateException( |
103 |
| - "User has no providers even though we got a collision."); |
| 108 | + Log.w(TAG, "No providers known for user (" |
| 109 | + + mEmail |
| 110 | + + ") this email address may be reserved."); |
| 111 | + setResult(Resource.<IdpResponse>forFailure( |
| 112 | + new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR))); |
| 113 | + return; |
104 | 114 | }
|
105 | 115 |
|
106 | 116 | if (EmailAuthProvider.PROVIDER_ID.equalsIgnoreCase(provider)) {
|
|
0 commit comments