ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Views/Customer/EnableTwoFactorAuthenticator.cshtml
@model CustomerInfoModel.TwoFactorAuthenticationModel
@using Grand.Web.Models.Customer;
@inject IPageHeadBuilder pagebuilder
@inject IWebHelper webHelper
@{
    Layout = "_ColumnsTwo";
    //title
    pagebuilder.AddTitleParts(T("PageTitle.TwoFactorAuth").Text);
    var code = "ManualEntryQrCode";
    var imageUrl = "QrCodeImageUrl";

}
@section left
{
    @await Component.InvokeAsync("CustomerNavigation", new { selectedTabId = CustomerNavigationEnum.Info })
}

<div class="page login-page">
    <h2 class="generalTitle">@T("Account.TwoFactorAuth.Enable")</h2>
    <ul class="pl-0">
        <li><b>@T($"Account.TwoFactorAuth.{Model.TwoFactorAuthenticationType}.FirstLine")</b></li>
        <li>@T($"Account.TwoFactorAuth.{Model.TwoFactorAuthenticationType}.SecondLine")</li>
        <li><b>@T($"Account.TwoFactorAuth.{Model.TwoFactorAuthenticationType}.ThirdLine")</b></li>
        <li>@T($"Account.TwoFactorAuth.{Model.TwoFactorAuthenticationType}.FourthLine")</li>
    </ul>
    @if (Model.TwoFactorAuthenticationType == Grand.Domain.Customers.TwoFactorAuthenticationType.AppVerification)
    {
        @await Component.InvokeAsync("Widget", new { widgetZone = "Enable.TwoFactorAuthentication.AppVerification" })
        <div class="mb-2">
            <div class="row flex-md-row mt-3 mb-3">
                @* login main block *@
                <div class="col-lg-6 col-12 text-center">
                    <div class="card">
                        <div class="col-12 form-group mb-0">
                            <div>
                                <img src="@(Model.CustomValues[imageUrl])" />
                            </div>
                            <div>
                                @T("Account.TwoFactorAuth.ManualSetupCode") @(Model.CustomValues[code])
                            </div>
                        </div>
                        <form asp-route="EnableTwoFactorAuthorization" asp-route-returnurl="@Context.Request.Query["ReturnUrl"]" method="post">
                            <input asp-for="SecretKey" type="hidden" />
                            <input asp-for="TwoFactorAuthenticationType" type="hidden" />
                            <input asp-for="@Model.CustomValues[code]" type="hidden" />
                            <input asp-for="@Model.CustomValues[imageUrl]" type="hidden" />
                            <div class="card-body">
                                <div class="row justify-content-center">
                                    <div asp-validation-summary="ModelOnly" class="message-error"></div>
                                    <div class="col-12 form-group mb-0">
                                        <div class="form-group row">
                                            <div class="col-lg-3 col-12">
                                                <label asp-for="Code" class="col-form-label">@T("Account.TwoFactorAuth.DigitCode")</label>
                                            </div>
                                            <div class="col-lg-9 col-12">
                                                <input asp-for="Code" name="Code" type="text" class="form-control" autofocus />
                                                <span asp-validation-for="Code"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="card-footer">
                                <div class="buttons">
                                    <input class="btn btn-info login-button" type="submit" value="@T("Account.TwoFactorAuth.SendCode")" />
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    }
    @if (Model.TwoFactorAuthenticationType == Grand.Domain.Customers.TwoFactorAuthenticationType.EmailVerification)
    {
        @await Component.InvokeAsync("Widget", new { widgetZone = "Enable.TwoFactorAuthentication.EmailVerification" })
        <div class="mb-2">
            <div class="row flex-md-row mt-3 mb-3">
                <div class="col-lg-6 col-12 text-center">
                    <div class="card">
                        <form asp-route="EnableTwoFactorAuthorization" asp-route-returnurl="@Context.Request.Query["ReturnUrl"]" method="post">
                            <input asp-for="SecretKey" type="hidden" />
                            <input asp-for="TwoFactorAuthenticationType" type="hidden" />
                            <div class="card-body">
                                <div class="row justify-content-center">
                                    <div asp-validation-summary="ModelOnly" class="message-error"></div>
                                    <div class="col-12 form-group mb-0">
                                        <div class="form-group row">
                                            <div class="col-lg-3 col-12">
                                                <label asp-for="Code" class="col-form-label">@T("Account.TwoFactorAuth.DigitCode")</label>
                                            </div>
                                            <div class="col-lg-9 col-12">
                                                <input asp-for="Code" name="Code" type="text" class="form-control" autofocus />
                                                <span asp-validation-for="Code"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="card-footer">
                                <div class="buttons">
                                    <input class="btn btn-info login-button" type="submit" value="@T("Account.TwoFactorAuth.SendCode")" />
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    }
    @if (Model.TwoFactorAuthenticationType == Grand.Domain.Customers.TwoFactorAuthenticationType.SMSVerification)
    {
        @await Component.InvokeAsync("Widget", new { widgetZone = "Enable.TwoFactorAuthentication.SMSVerification" })
        <div class="mb-2">
            <div class="row flex-md-row mt-3 mb-3">
                <div class="col-lg-6 col-12 text-center">
                    <div class="card">
                        <form asp-route="EnableTwoFactorAuthorization" asp-route-returnurl="@Context.Request.Query["ReturnUrl"]" method="post">
                            <input asp-for="SecretKey" type="hidden" />
                            <input asp-for="TwoFactorAuthenticationType" type="hidden" />
                            <div class="card-body">
                                <div class="row">
                                    <div asp-validation-summary="ModelOnly" class="message-error"></div>
                                    <div class="col-12 form-group mb-0">
                                        <div class="form-group row">
                                            <div class="col-lg-3 col-12">
                                                <label asp-for="Code" class="col-form-label">@T("Account.TwoFactorAuth.DigitCode")</label>
                                            </div>
                                            <div class="col-lg-9 col-12">
                                                <input asp-for="Code" name="Code" type="text" class="form-control" autofocus />
                                                <span asp-validation-for="Code"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="card-footer">
                                <div class="buttons">
                                    <input class="btn btn-info login-button" type="submit" value="@T("Account.TwoFactorAuth.SendCode")" />
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    }
</div>