Я создаю нового пользователя через мое приложение, используя Firebase createUserWithEmailAndPassword (), и пользователь создается.Но когда я пытаюсь снова войти в систему, появляется предупреждение авторизации firebase:
W / BiChannelGoogleApi: [FirebaseAuth:] getGoogleApiForMethod () вернул Gms: com.google.firebase.auth.api.internal.zzal @ bd27b3b
Также, когда я пытался зарегистрировать ошибку, она показывает:
D / Firebase: пароль недействителен или у пользователя нет пароля.
Вот скриншот зависимостей:
https://drive.google.com/open?id=1-wO7VpyjezGm59NnmE8GC7JUm14fXAYV
А вот логкат
https://drive.google.com/open?id=1odYzcDf5mtHe7F4riTxVMZOyYOEiwGa2
Вот фрагмент кода входа в систему пользователя
mAuth = FirebaseAuth.getInstance();
mSignIn = findViewById(R.id.signin_button);
mSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mUser = username.getText().toString().trim();
mPass = username.getText().toString().trim();
if (inputValidate(mUser, mPass)) {
mAuth.signInWithEmailAndPassword(mUser, mPass)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
startActivity(new Intent(getApplicationContext(), HomeScreen.class));
} else {
// If sign in fails, display a message to the user.
Log.d("Firebase",task.getException().getMessage());
Toast.makeText(LoginActivity.this, "Invalid credentials", Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
signUp = findViewById(R.id.signup_button);
signUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(),SignUp.class));
}
});
}
private boolean inputValidate(String user, String pass){
if(user.equals("")){
Toast.makeText(getApplicationContext(), "Please enter Email", Toast.LENGTH_SHORT).show();
username.requestFocus();
return false;
}
else if(pass.equals("")){
Toast.makeText(getApplicationContext(), "Please enter Password", Toast.LENGTH_SHORT).show();
password.requestFocus();
return false;
}
else return true;
}
Fir Регистрация пользователя
if(inputValidate(mEmail,mPassword,mConfPassword,mClass,mPhone,mName)){
mProgressBar.setVisibility(View.VISIBLE);
final FirebaseAuth mAuth =FirebaseAuth.getInstance();
mAuth.createUserWithEmailAndPassword(mEmail,mPassword).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
mProgressBar.setVisibility(View.GONE);
Log.d("Firebase User",task.getResult().toString());
FirebaseUser mUser = mAuth.getCurrentUser();
if(mUser!=null) {
muserId = mUser.getUid();
}
UserDetails user = new UserDetails(mName,mPhone,mClass,mEmail);
mProfileDatabaseReference.child(muserId).push().setValue(user);
Intent i =new Intent(getApplicationContext(),HomeScreen.class);
i.putExtra("Name",mName);
i.putExtra("Email",mEmail);
i.putExtra("Phone",mPhone);
startActivity(i);
}
else
Toast.makeText(SignUp.this, "Sign Up failed.Please try in some time", Toast.LENGTH_SHORT).show();
mProgressBar.setVisibility(View.GONE);
}
});
}
}
});
}
private boolean inputValidate(String email,String pass,String cpass,String mClasss, String phone, String name ){
if(email.equals("")){
Toast.makeText(getApplicationContext(), "Please enter Email", Toast.LENGTH_SHORT).show();
eEmail.requestFocus();
return false;
}
else if(pass.equals("")){
Toast.makeText(getApplicationContext(), "Please enter Password", Toast.LENGTH_SHORT).show();
ePassword.requestFocus();
return false;
}
else if (!cpass.equals(pass)){
Toast.makeText(getApplicationContext(), "Password and Confirm Password dont match", Toast.LENGTH_SHORT).show();
eConfPassword.requestFocus();
return false;
} else if (mClasss.equals("")){
Toast.makeText(getApplicationContext(), "Please select Class", Toast.LENGTH_SHORT).show();
classSpinner.requestFocus();
return false;
} else if (phone.equals("")){
Toast.makeText(getApplicationContext(), "Please enter phone number", Toast.LENGTH_SHORT).show();
ePhone.requestFocus();
return false;
} else if (name.equals("")){
Toast.makeText(getApplicationContext(), "Please enter your Name", Toast.LENGTH_SHORT).show();
eName.requestFocus();
return false;
}
else return true;
}