Firebase身份验证失败

时间:2018-11-20 17:26:43

标签: android firebase firebase-authentication

我按照Firebase的步骤创建了新用户,但出现错误,这是我的方法,被一个onClickListener调用,怎么了?

private void newUser(){

    String finalEmail, finalPassword, repassw;
    finalEmail = email.getText().toString();
    finalPassword = password.getText().toString();
    repassw = repassword.getText().toString();

    if (finalPassword.equals(repassw)){
        mAuth.createUserWithEmailAndPassword(finalEmail, finalPassword).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(@NonNull Task<AuthResult> task) {
                if (task.isSuccessful()){
                    Toast.makeText(SignUp.this,"Sucessfull!",Toast.LENGTH_SHORT).show();
                }
                else {
                    Toast.makeText(SignUp.this,"Error!",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
    else {
        Toast.makeText(this,"Not the same password", Toast.LENGTH_SHORT).show();
    }
}

0 个答案:

没有答案