<div data-ng-if="!Authentication.requireAuthCode">
  <div data-ng-if="public.receivers.length === 1">
    <div class="form-group">
      <input class="form-control" name="password" placeholder="{{'Password' | translate}}" data-ng-model="loginData.loginPassword" type="password" required />
    </div>
    <div class="form-group" data-ng-init="loginData.loginUsername = public.receivers[0].id">
      <button id="login-button" class="btn btn-primary" data-ng-disabled="Authentication.loginInProgress || loginForm.$invalid" data-ng-click="Authentication.login(0, loginData.loginUsername, loginData.loginPassword)" type="submit">
        <i class="fa-solid fa-sign-in-alt"></i>
        <span data-translate>Log in</span>
      </button>

      <span id="forgot-button">
        <a class="btn btn-outline-secondary" href="#/login/passwordreset" data-translate>Forgot password?</a>
      </span>
    </div>
  </div>

  <div data-ng-if="public.receivers.length !== 1">
    <div class="form-group">
      <label data-translate>Please select your account:</label>
      <select class="form-control" data-ng-model="loginData.loginUsername" data-ng-options="item.id as item.name for item in public.receivers | orderBy:'name'" required></select>
    </div>

    <div data-ng-show="loginData.loginUsername">
      <div class="form-group">
        <label data-translate>Now type your password, then click 'Log in':</label>
        <input class="form-control" name="password" data-ng-model="loginData.loginPassword" type="password" required />
      </div>

      <div class="form-group">
        <button id="login-button" class="btn btn-primary" data-ng-disabled="Authentication.loginInProgress || loginForm.$invalid" data-ng-click="Authentication.login(0, loginData.loginUsername, loginData.loginPassword)" type="submit">
          <i class="fa-solid fa-sign-in-alt"></i>
          <span data-translate>Log in</span>
        </button>

        <span id="forgot-button">
          <a class="btn btn-outline-secondary" href="/#/login/passwordreset" data-translate>Forgot password?</a>
        </span>
      </div>
    </div>
  </div>
</div>

<div data-ng-if="Authentication.requireAuthCode">
  <div class="form-group">
    <label data-translate>Enter the two factor authentication code</label>
    <input class="form-control" data-ng-model="loginData.loginAuthCode" type="text" size="6" maxlength="6" required />
  </div>

  <button id="login-button" class="btn btn-primary" data-ng-disabled="Authentication.loginInProgress || loginForm.$invalid" data-ng-click="Authentication.login(0, loginData.loginUsername, loginData.loginPassword, loginData.loginAuthCode)" type="submit">
    <i class="fa-solid fa-sign-in-alt"></i>
    <span data-translate>Log in</span>
  </button>
</div>
