code: function login(credentials = {
      username: settings.username,
      password: settings.password,
      ldap: settings.ldap
  }) {
      let login;
      // if (credentials.ldap) {
      //   logger.info(`[login] Logging in ${credentials.username} with LDAP`)
      //   login = asteroid.loginWithLDAP(
      //     credentials.email || credentials.username,
      //     credentials.password,
      //     { ldap: true, ldapOptions: credentials.ldapOptions || {} }
      //   )
      // } else {
      log_1.logger.info(`[login] Logging in ${credentials.username}`);
      login = exports.asteroid.loginWithPassword(credentials.email || credentials.username, credentials.password);
      // }
      return login
          .then((loggedInUserId) => {
          exports.userId = loggedInUserId;
          return loggedInUserId;
      })
          .catch((err) => {
          log_1.logger.info('[login] Error:', err);
          throw err; // throw after log to stop async chain
      });
  }
docs: LOGIN AND SUBSCRIBE TO ROOMS ----------------------------------------------------------------------------- Login to Rocket.Chat via Asteroid