Skip to content

augustina55/FirebaseEmailPasswordLogin

Repository files navigation

FirebaseEmailPasswordLogin

Email and Password login using Firebase Authentication

Simple Login Page using Firebase Authentication
1.Login Page
2.Register Page
3.Forgot Password

Registration

    mAuth.createUserWithEmailAndPassword(email,pass)
            .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if(task.isSuccessful()){
                        //Account Created 
                        
                    }                      
                }
            }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            //Something went wrong
        }
    });

Login using email and pass

mAuth=FirebaseAuth.getInstance();
mAuth.signInWithEmailAndPassword(email,pass)
            .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if(task.isSuccessful()){
                        //Login Successfull
                        
                    }else{
                        //Login Failed
                       
                    }
                }
            });

Reset/Forgot Password Link

mAuth.sendPasswordResetEmail(resetEmail.getText().toString())
            .addOnCompleteListener(new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    if(task.isSuccessful()){
                        //Reset password link will be shared to the Email address
                      
                    }
                }
            }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
           //Something went problem
        }
    });

Releases

No releases published

Packages

No packages published

Languages