Can you help me understand why this class does not refrain the user? In practice, when I enter email, password, etc. then I click on registration gives me that the user has not been registered, how can I do?
public void singUpUser(final String email , final String password, final String nickName, final String confermaPassword) {
final ProgressDialog dialog = new ProgressDialog(mContext);
dialog.setMessage("Stiamo registrando l'utente....");
dialog.setCancelable(false);
dialog.show();
mAuth.signInWithEmailAndPassword(email,password)
.addOnCompleteListener(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
Log.d(TAG, "crearUterWithEmail:Success");
dialog.dismiss();
Map<String,Object> creaUtente = new HashMap<>();
creaUtente.put("email", email);
creaUtente.put("password", password);
creaUtente.put("nickName", nickName);
creaUtente.put("confermaPassword", confermaPassword);
mDatabase.child("Utente").child(task.getResult().getUser().getUid()).updateChildren(creaUtente);
Intent intent = new Intent(mContext, activity_singIn.class);
mContext.startActivity(intent);
} else {
dialog.dismiss();
// If sign in fails, display a message to the user.
Log.w(TAG, "crearUterWithEmail:failure", task.getException());
Toast.makeText(mContext, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
}
}