In the application, before the user logs in, he needs to log in with email and password. If you do not have it you can create an account.
The problem happened last night, users already registered can not log in anymore and do not give any errors. But if I create a new account, on this screen I have programmed that once the registration is done already log in the app.
The problem seems to be the login screen. In my lopcat it appears
D/FirebaseAuth: Notifying id token listeners about user ( 7zWrS3nX2lW815oOMzwoxyFRbzc2 ).
D/FirebaseApp: Notifying auth state listeners.
D/FirebaseApp: Notified 0 auth state listeners.
If I put the wrong password or wrong email, it is no longer checking as well, and days ago it was working normally.
My login screen
public class TeladeLoginActivity extends AppCompatActivity {
private EditText edt_Email;
private EditText edt_Senha;
private TextView txt_CriarConta;
private Button btn_Logar;
private ProgressBar progressBarLogin;
ValidaEmail validaEmail;
private FirebaseAuth autenticacao;
VerificaInternet verificaInternet;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_telade_login);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().hide();
edt_Email = (EditText) findViewById(R.id.edt_TelaLogin_Email);
edt_Senha = (EditText) findViewById(R.id.edt_TelaLogin_Password);
txt_CriarConta = (TextView) findViewById(R.id.txt_CriarUmaConta);
btn_Logar = (Button) findViewById(R.id.btn_LogarApp);
progressBarLogin = (ProgressBar) findViewById(R.id.progressBarLogin);
verificaInternet = new VerificaInternet(this);
validaEmail = new ValidaEmail();
btn_Logar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (edt_Email.getText().toString().isEmpty() ||
edt_Senha.getText().toString().isEmpty()) {
Toast.makeText(TeladeLoginActivity.this, "Campos não podem ficar vazios",
Toast.LENGTH_SHORT).show();
}else if (!validaEmail.validar(edt_Email.getText().toString())){
edt_Senha.setError("Verifique o email digitado");
}else {
String emailUsuario = edt_Email.getText().toString().trim();
String senhaUsuario = edt_Senha.getText().toString().trim();
criarUser(emailUsuario, senhaUsuario);
}
}
});
txt_CriarConta.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent cadastrarUsuario = new Intent(TeladeLoginActivity.this, CadastrarContaActivity.class);
startActivity(cadastrarUsuario);
}
});
}
@Override
protected void onStart() {
super.onStart();
autenticacao = AutenticacaoLogin.getFirebaseAuth();
}
private void criarUser(String emailUsuario, final String senhaUsuario) {
// progressBarLogin.setVisibility(View.VISIBLE);
autenticacao.signInWithEmailAndPassword(
emailUsuario, senhaUsuario
).addOnCompleteListener(TeladeLoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (verificaInternet.existeConexao()){
}else if (task.isSuccessful()) {
progressBarLogin.setVisibility(View.INVISIBLE);
Intent abrirApp = new Intent(TeladeLoginActivity.this, MainActivity.class);
startActivity(abrirApp);
} else {
progressBarLogin.setVisibility(View.INVISIBLE);
String erroExcecao = "";
try {
throw task.getException();
} catch (FirebaseAuthInvalidCredentialsException e) {
erroExcecao = "Email inválido";
} catch (FirebaseAuthUserCollisionException e) {
erroExcecao = "Esse e-mail já está em uso no App.";
} catch (Exception e) {
if (senhaUsuario.length() < 6) {
edt_Senha.setText("");//Limpa o campo de texto para o usuário digitar uma nova senha mais forte
edt_Senha.requestFocus();//Seta o focus no campo de texto
Toast.makeText(TeladeLoginActivity.this, "Senha incorreta", Toast.LENGTH_LONG).show();
}
erroExcecao = "Erro ao logar no aplicativo.";
e.printStackTrace();
}
Toast.makeText(TeladeLoginActivity.this, "Erro: " + erroExcecao, Toast.LENGTH_LONG).show();
}
}
});
}
}