Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

2.5 KB
Raw Blame
<div class="modal-header justify-content-center">
  <h4 class="modal-title">
    <svg [lucideIcon]="icons.LucideLock"></svg>
    @if (withTwoFaEnabled) {
      <span l10nTranslate>Two-Factor Authentication</span>
    } @else {
      <span l10nTranslate>Password Authentication</span>
    }
  </h4>
</div>
<div class="modal-body modal-auth-verify-2fa">
  <div class="card shadow-sm">
    <div class="card-body p-3">
      <form (ngSubmit)="onSubmit()" [formGroup]="twoFaForm" class="d-flex flex-column gap-3 align-items-center">
        @if (withPassword) {
          <div class="w-100" style="max-width: 360px;">
            <label class="form-label text-muted text-uppercase fs-sm d-block text-center mb-2" for="twoFaVerifyPassword" l10nTranslate>Enter your password</label>
            <app-input-password inputId="twoFaVerifyPassword"
                                class="d-block w-100"
                                [password]="twoFaForm.value.password"
                                (passwordChange)="updatePassword($event)"
                                [focus]="true"
                                [centered]="true"
                                placeholder="••••••">
            </app-input-password>
          </div>
        }
        @if (withTwoFaEnabled) {
          <div class="w-100" style="max-width: 360px;">
            <label class="form-label text-muted text-uppercase fs-sm d-block text-center mb-2" for="totp" l10nTranslate>Valid with your TOTP code</label>
            <input
              id="totp"
              appAutofocus
              [autoFocus]="!withPassword"
              [autoSelect]="!withPassword"
              type="text"
              [maxlength]="twoFaCodelength"
              class="form-control text-center text-bold font-monospace w-100"
              formControlName="totpCode"
              placeholder="••••••"
              inputmode="numeric"
              autocomplete="one-time-code"
              name="totp"
            />
          </div>
        }

        @if (hasError) {
          <div class="alert alert-danger py-2 mb-0 text-center" l10nTranslate>{{ hasError }}</div>
        }

        <div class="d-flex gap-2 pt-1 w-100">
          <button type="button" (click)="onClose()" class="btn btn-secondary flex-fill" l10nTranslate>Cancel</button>
          <button type="submit" [disabled]="twoFaForm.invalid || submitted" class="btn btn-primary flex-fill" l10nTranslate>Confirm</button>
        </div>
      </form>
    </div>
  </div>
</div>