@model EnableTwoFactorViewModel
@{
    ViewData["Title"] = "Enable Two Factor";
}

<div class="page-heading compact">
    <div>
        <p class="eyebrow">Account</p>
        <h1>Enable Two Factor Authentication</h1>
        <p class="lead-text">Scan the QR code with Microsoft Authenticator, Google Authenticator, Authy or another compatible app.</p>
    </div>
</div>

<section class="edit-panel">
    @if (!string.IsNullOrWhiteSpace(Model.QrCodeImageDataUri))
    {
        <img src="@Model.QrCodeImageDataUri" alt="Two-factor QR code" class="img-fluid mb-3" style="max-width:220px;" />
    }
    else
    {
        <div class="alert alert-warning">QR code generation was not available. Enter the manual secret below in your authenticator app.</div>
    }

    <p><strong>Manual secret:</strong> <code>@Model.SecretKey</code></p>

    <form asp-action="EnableTwoFactor" method="post" class="asset-create-form">
        <input asp-for="SecretKey" type="hidden" />
        <input asp-for="QrCodeUri" type="hidden" />
        <div asp-validation-summary="ModelOnly" class="alert alert-warning"></div>

        <div class="row g-3">
            <div class="col-md-6">
                <label class="form-label" asp-for="Code">Verification code</label>
                <input class="form-control" asp-for="Code" autocomplete="one-time-code" />
                <span class="text-danger" asp-validation-for="Code"></span>
            </div>
        </div>

        <div class="button-row mt-3">
            <button class="btn btn-primary" type="submit">Enable Two Factor</button>
            <a class="btn btn-outline-secondary" asp-action="Index">Cancel</a>
        </div>
    </form>
</section>

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}
