imtiaz ahmed
imtiaz ahmed

Reputation: 11

The email address is badly formatted Firebase/ android project

hi i am working on a android project where i am using firebase as back-end and i am building a signup and login form . When ever i sign up the code is working well and . When i try to retrieve it using "signInWithEmailAndPassword i am getting the fallowing error. The email address is badly formatted Firebase`

login Activity

public class login extends AppCompatActivity {

    Button create_Account, login_btn;
    EditText l_email, l_password;
    FirebaseAuth fAuth;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        fAuth = FirebaseAuth.getInstance();

        create_Account = findViewById(R.id.l_signup_btn);

        create_Account.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(login.this, MainActivity.class));
            }
        });

        l_password = findViewById(R.id.et_lpassword);
        l_email = findViewById(R.id.et_lpassword);
        login_btn = findViewById(R.id.l_login_btn);

        login_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (l_email.getText().toString().isEmpty()) {

                    l_email.setError("Email is Missing");
                    return;
                }

                if (l_password.getText().toString().isEmpty()) {

                    l_password.setError("Password is Missing");
                    return;
                }

                fAuth.signInWithEmailAndPassword(l_email.getText().toString(), l_password.getText().toString()).addOnSuccessListener(new OnSuccessListener<AuthResult>() {
                    @Override
                    public void onSuccess(AuthResult authResult) {
                        startActivity(new Intent(getApplicationContext(), dashboard.class));
                        finish();
                    }
                }).addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {

                        Toast.makeText(login.this, e.getMessage(), Toast.LENGTH_SHORT).show();

                    }
                });
            }
        });
    }

    @Override
    protected void onStart() {
        super.onStart();
        if (FirebaseAuth.getInstance().getCurrentUser() != null) {
            startActivity(new Intent(getApplicationContext(), dashboard.class));
            finish();
        }
    }
}

Upvotes: 1

Views: 61

Answers (1)

anonymous
anonymous

Reputation: 228

Can you see what mistake you have

l_password  =   findViewById(R.id.et_lpassword);
    l_email =   findViewById(R.id.et_lpassword);

Upvotes: 1

Related Questions