<form (ngSubmit)="submit()">
  <app-header>
    <div class="left"></div>
    <h1 class="center">
      <span class="title">{{ "verifyIdentity" | i18n }}</span>
    </h1>
    <div class="right">
      <button type="submit" *ngIf="pinEnabled || masterPasswordEnabled">
        {{ "unlock" | i18n }}
      </button>
    </div>
  </app-header>
  <main tabindex="-1">
    <ng-container *ngIf="fido2PopoutSessionData$ | async as fido2Data">
      <div class="box">
        <div class="box-content">
          <div
            class="box-content-row box-content-row-flex"
            appBoxRow
            *ngIf="pinEnabled || masterPasswordEnabled"
          >
            <div class="row-main" *ngIf="pinEnabled">
              <label for="pin">{{ "pin" | i18n }}</label>
              <input
                id="pin"
                type="{{ showPassword ? 'text' : 'password' }}"
                name="PIN"
                class="monospaced"
                [(ngModel)]="pin"
                required
                appInputVerbatim
              />
            </div>
            <div class="row-main" *ngIf="masterPasswordEnabled && !pinEnabled">
              <label for="masterPassword">{{ "masterPass" | i18n }}</label>
              <input
                id="masterPassword"
                type="{{ showPassword ? 'text' : 'password' }}"
                name="MasterPassword"
                aria-describedby="masterPasswordHelp"
                class="monospaced"
                [(ngModel)]="masterPassword"
                required
                appInputVerbatim
              />
            </div>
            <div class="action-buttons">
              <button
                type="button"
                class="row-btn"
                appStopClick
                appA11yTitle="{{ 'toggleVisibility' | i18n }}"
                (click)="togglePassword()"
                [attr.aria-pressed]="showPassword"
              >
                <i
                  class="bwi bwi-lg"
                  [ngClass]="{ 'bwi-eye': !showPassword, 'bwi-eye-slash': showPassword }"
                  aria-hidden="true"
                ></i>
              </button>
            </div>
          </div>
        </div>
        <div id="masterPasswordHelp" class="box-footer">
          <p>
            {{
              fido2Data.isFido2Session
                ? ("yourPasskeyIsLocked" | i18n)
                : ("yourVaultIsLocked" | i18n)
            }}
          </p>
          {{ "loggedInAsOn" | i18n: email : webVaultHostname }}
        </div>
      </div>
      <div class="box" *ngIf="biometricLock">
        <div class="box-footer no-pad">
          <button
            type="button"
            class="btn primary block"
            (click)="unlockBiometric()"
            appStopClick
            [disabled]="pendingBiometric"
          >
            {{ "unlockWithBiometrics" | i18n }}
          </button>
        </div>
      </div>
      <p class="text-center" *ngIf="!fido2Data.isFido2Session">
        <button type="button" appStopClick (click)="logOut()">{{ "logOut" | i18n }}</button>
      </p>
      <app-private-mode-warning></app-private-mode-warning>
      <app-callout *ngIf="biometricError" type="error">{{ biometricError }}</app-callout>
      <p class="text-center text-muted" *ngIf="pendingBiometric">
        <i class="bwi bwi-spinner bwi-spin" aria-hidden="true"></i> {{ "awaitDesktop" | i18n }}
      </p>

      <app-fido2-use-browser-link></app-fido2-use-browser-link>
    </ng-container>
  </main>
</form>
