code: private void attemptLogin() {
          if (mAuth != null) {
              return;
          }
  
          // Reset errors.
          mEmailView.setError(null);
          mPasswordView.setError(null);
  
          // Store values at the time of the login attempt.
          String email = mEmailView.getText().toString();
          String password = mPasswordView.getText().toString();
  
          boolean cancel = false;
          View focusView = null;
  
  
          // Check for a valid password, if the user entered one.
          if (TextUtils.isEmpty(password) || !isPasswordValid(password)) {
              mPasswordView.setError(getString(R.string.error_invalid_password));
              focusView = mPasswordView;
              cancel = true;
          }
  
          // Check for a valid email address.
          if (TextUtils.isEmpty(email)) {
              mEmailView.setError(getString(R.string.error_field_required));
              focusView = mEmailView;
              cancel = true;
          } else if (!isEmailValid(email)) {
              mEmailView.setError(getString(R.string.error_invalid_email));
              focusView = mEmailView;
              cancel = true;
          }
  
          if (cancel) {
              // There was an error; don't attempt login and focus the first
              // form field with an error.
              focusView.requestFocus();
          } else {
              // Show a progress spinner, and kick off a background task to
              // perform the user login attempt.
              showProgress(true);
              mAuth = BaasUser.withUserName(email)
                              .setPassword(password)
                              .login(loginHandler);
  
          }
      }
docs: Attempts to sign in or register the account specified by the login form.
  If there are form errors (invalid email, missing fields, etc.), the
  errors are presented and no actual login attempt is made.