title: User login in Firebase
body: <p>I built with Firebase two options for registration, one can register as an employer and another option to register as an worker. I gave an ID to them, and each employer received the letter 'e' at the beginning of the ID and the worker received the letter 'w' at the beginning of the ID so that I could identify them.</p>
  
  <p>I also created the possibility of connecting with Firebase and I want if I connect as a worker I will switch to a certain screen and if I connect as an employer I will switch to another screen.</p>
  
  <p>I store the information inside the Firestore. Each document in the collection receives the UID of that user within the document. The ID is found with the letters.</p>
  
  <p>I try this.</p>
  
  <pre><code>private char s = 'e';
  mAuth.signInWithEmailAndPassword(email, password)
  .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
      @Override
      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
  
          if(task.isSuccessful())
          {
  
              mDatabase.collection("employer").document(mUser.getUid()).get().addOnCompleteListener(new OnCompleteListener&lt;DocumentSnapshot&gt;() {
                  @Override
                  public void onComplete(@NonNull Task&lt;DocumentSnapshot&gt; task) {
                      if (task.isSuccessful())
                      {
                          DocumentSnapshot documentSnapshot = task.getResult();
                          index = documentSnapshot.getString("ID");
                          ID = index.charAt(0);
                      }
                  }
              }).addOnFailureListener(new OnFailureListener() {
                  @Override
                  public void onFailure(@NonNull Exception e) {
                      mDatabase.collection("worker").document(mUser.getUid()).get().addOnCompleteListener(new OnCompleteListener&lt;DocumentSnapshot&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;DocumentSnapshot&gt; task) {
                              DocumentSnapshot documentSnapshot = task.getResult();
                              index = documentSnapshot.getString("ID");
                              ID = index.charAt(0);
                          }
                      });
                  }
              });
  
              if(mUser.isEmailVerified())
              {
  
                  if(ID == s)
                  {
                      Intent k = new Intent(login_page.this,home_screen_employer.class);
                      startActivity(k);
                  }
                  else {
                      Intent k = new Intent(login_page.this,home_screen_worker.class);
                      startActivity(k);
                  }
          }
  </code></pre>