Java 类com.google.firebase.auth.FirebaseAuthInvalidUserException 实例源码

项目:FirebaseUI-Android    文件:RecoverPasswordActivity.java   
private void next(final String email) {
    getAuthHelper().getFirebaseAuth()
            .sendPasswordResetEmail(email)
            .addOnFailureListener(
                    new TaskFailureLogger(TAG, "Error sending password reset email"))
            .addOnSuccessListener(new OnSuccessListener<Void>() {
                @Override
                public void onSuccess(Void aVoid) {
                    getDialogHolder().dismissDialog();
                    RecoveryEmailSentDialog.show(
                            email, getSupportFragmentManager());
                }
            })
            .addOnFailureListener(this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    getDialogHolder().dismissDialog();

                    if (e instanceof FirebaseAuthInvalidUserException) {
                        // No FirebaseUser exists with this email address, show error.
                        mEmailEditText.setError(getString(R.string.fui_error_email_does_not_exist));
                    }
                }
            });
}
项目:FirebaseUI-Android    文件:SignInDelegate.java   
/**
 * Begin sign in process with email and password from a SmartLock credential. On success, finish
 * with {@link Activity#RESULT_OK}. On failure, delete the credential from SmartLock (if
 * applicable) and then launch the auth method picker flow.
 */
private void signInWithEmailAndPassword(String email, String password) {
    final IdpResponse response =
            new IdpResponse.Builder(new User.Builder(EmailAuthProvider.PROVIDER_ID, email).build())
                    .build();

    getAuthHelper().getFirebaseAuth()
            .signInWithEmailAndPassword(email, password)
            .addOnSuccessListener(new OnSuccessListener<AuthResult>() {
                @Override
                public void onSuccess(AuthResult authResult) {
                    finish(Activity.RESULT_OK, response.toIntent());
                }
            })
            .addOnFailureListener(new TaskFailureLogger(
                    TAG, "Error signing in with email and password"))
            .addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    if (e instanceof FirebaseAuthInvalidUserException
                            || e instanceof FirebaseAuthInvalidCredentialsException) {
                        // In this case the credential saved in SmartLock was not
                        // a valid credential, we should delete it from SmartLock
                        // before continuing.
                        deleteCredentialAndRedirect();
                    } else {
                        startAuthMethodChoice();
                    }
                }
            });
}