<app-header>
  <div class="left">
    <button type="button" routerLink="/tabs/settings">
      <span class="header-icon"><i class="bwi bwi-angle-left" aria-hidden="true"></i></span>
      <span>{{ "back" | i18n }}</span>
    </button>
  </div>
  <h1 class="center">
    <span class="title">{{ "accountSecurity" | i18n }}</span>
  </h1>
  <div class="right">
    <app-pop-out></app-pop-out>
  </div>
</app-header>
<main tabindex="-1" [formGroup]="form">
  <div class="box list">
    <h2 class="box-header">{{ "unlockMethods" | i18n }}</h2>
    <div class="box-content single-line">
      <div class="box-content-row box-content-row-checkbox" appBoxRow *ngIf="supportsBiometric">
        <label for="biometric">{{ "unlockWithBiometrics" | i18n }}</label>
        <input id="biometric" type="checkbox" formControlName="biometric" />
      </div>
      <div
        class="box-content-row box-content-row-checkbox"
        appBoxRow
        *ngIf="supportsBiometric && this.form.value.biometric"
      >
        <label for="autoBiometricsPrompt">{{ "enableAutoBiometricsPrompt" | i18n }}</label>
        <input
          id="autoBiometricsPrompt"
          type="checkbox"
          (change)="updateAutoBiometricsPrompt()"
          formControlName="enableAutoBiometricsPrompt"
        />
      </div>
      <div class="box-content-row box-content-row-checkbox" appBoxRow>
        <label for="pin">{{ "unlockWithPin" | i18n }}</label>
        <input id="pin" type="checkbox" formControlName="pin" />
      </div>
    </div>
  </div>
  <div class="box list">
    <h2 class="box-header">{{ "sessionTimeoutHeader" | i18n }}</h2>
    <div class="box-content single-line">
      <app-callout type="info" *ngIf="vaultTimeoutPolicyCallout | async as policy">
        <span *ngIf="policy.timeout && policy.action">
          {{
            "vaultTimeoutPolicyWithActionInEffect"
              | i18n: policy.timeout.hours : policy.timeout.minutes : (policy.action | i18n)
          }}
        </span>
        <span *ngIf="policy.timeout && !policy.action">
          {{ "vaultTimeoutPolicyInEffect" | i18n: policy.timeout.hours : policy.timeout.minutes }}
        </span>
        <span *ngIf="!policy.timeout && policy.action">
          {{ "vaultTimeoutActionPolicyInEffect" | i18n: (policy.action | i18n) }}
        </span>
      </app-callout>
      <app-vault-timeout-input
        [vaultTimeoutOptions]="vaultTimeoutOptions"
        [formControl]="form.controls.vaultTimeout"
        ngDefaultControl
      >
      </app-vault-timeout-input>
      <div class="box-content-row display-block" appBoxRow>
        <label for="vaultTimeoutAction">{{ "vaultTimeoutAction" | i18n }}</label>
        <select
          id="vaultTimeoutAction"
          name="VaultTimeoutActions"
          formControlName="vaultTimeoutAction"
        >
          <option *ngFor="let action of availableVaultTimeoutActions" [ngValue]="action">
            {{ action | i18n }}
          </option>
        </select>
      </div>
      <div
        *ngIf="!availableVaultTimeoutActions.includes(VaultTimeoutAction.Lock)"
        id="unlockMethodHelp"
        class="box-footer"
      >
        {{ "unlockMethodNeededToChangeTimeoutActionDesc" | i18n }}
      </div>
    </div>
  </div>
  <div class="box list">
    <h2 class="box-header">{{ "otherOptions" | i18n }}</h2>
    <div class="box-content single-line">
      <button
        type="button"
        class="box-content-row box-content-row-flex text-default"
        appStopClick
        (click)="fingerprint()"
      >
        <div class="row-main">{{ "fingerprintPhrase" | i18n }}</div>
      </button>
      <button
        type="button"
        class="box-content-row box-content-row-flex text-default"
        appStopClick
        (click)="twoStep()"
      >
        <div class="row-main">{{ "twoStepLogin" | i18n }}</div>
        <i class="bwi bwi-external-link bwi-lg row-sub-icon" aria-hidden="true"></i>
      </button>
      <button
        type="button"
        class="box-content-row box-content-row-flex text-default"
        appStopClick
        (click)="changePassword()"
        *ngIf="showChangeMasterPass"
      >
        <div class="row-main">{{ "changeMasterPassword" | i18n }}</div>
        <i class="bwi bwi-external-link bwi-lg row-sub-icon" aria-hidden="true"></i>
      </button>
      <button
        *ngIf="
          !accountSwitcherEnabled && availableVaultTimeoutActions.includes(VaultTimeoutAction.Lock)
        "
        type="button"
        class="box-content-row box-content-row-flex text-default"
        appStopClick
        (click)="lock()"
      >
        <div class="row-main">{{ "lockNow" | i18n }}</div>
        <i class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i>
      </button>
      <button
        *ngIf="!accountSwitcherEnabled"
        type="button"
        class="box-content-row box-content-row-flex text-default"
        appStopClick
        (click)="logOut()"
      >
        <div class="row-main">{{ "logOut" | i18n }}</div>
        <i class="bwi bwi-angle-right bwi-lg row-sub-icon" aria-hidden="true"></i>
      </button>
    </div>
  </div>
</main>
