我在应用程序中添加了重置密码,一切正常,但是当我尝试对其进行测试时,向我展示了一条烤面包,并显示以下消息:“电子邮件地址格式错误”?
我试图将输入类型更改为textEmailAddress芽不起作用
public class ResetPasswordActivity extends AppCompatActivity {
EditText resetPassword;
Button resetbtn;
ProgressBar resetBar;
FirebaseAuth firebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reset_password);
resetPassword =findViewById(R.id.emailreset);
resetBar = findViewById(R.id.resetbar);
resetbtn = findViewById(R.id.resetbtn);
resetBar.setVisibility(View.GONE);
firebaseAuth = firebaseAuth.getInstance();
resetbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
resetBar.setVisibility(View.VISIBLE);
firebaseAuth.sendPasswordResetEmail(resetPassword.toString()).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
resetBar.setVisibility(View.GONE);
if (task.isSuccessful()){
Toast.makeText(ResetPasswordActivity.this,"Password sent to your Email",Toast.LENGTH_LONG).show();
}else{
Toast.makeText(ResetPasswordActivity.this,task.getException().getMessage(),Toast.LENGTH_LONG).show();
}
}
});
}
});
}
}
答案 0 :(得分:0)
您正在做
resetPassword =findViewById(R.id.emailreset);
然后:
firebaseAuth.sendPasswordResetEmail(resetPassword.toString())
这意味着您要将实际视图传递给对Firebase的调用,而不是用户输入的值。
您可能正在寻找:
resetPassword.getText().toString()