Merge pull request #3519 from dennisreimann/2fa-layout

Use simple layout for 2FA views
This commit is contained in:
Pavlenex 2022-03-08 13:42:28 +03:00 committed by GitHub
commit fe782bc3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 118 deletions

View File

@ -1,5 +1,6 @@
@{
Layout = "_LayoutSimple";
ViewBag.ShowTitle ??= true;
ViewBag.ShowLeadText ??= false;
}
@ -45,7 +46,10 @@
</div>
<div class="account-form">
@if (ViewBag.ShowTitle)
{
<h4>@ViewData["Title"]</h4>
}
@RenderBody()
</div>

View File

@ -1,12 +1,8 @@
@model LoginWith2faViewModel
<div class="row pt-5">
<div class="col-lg-12 section-heading">
<h2>Two-factor authentication</h2>
</div>
</div>
<div class="row mb-3">
<form class="col-12" method="post" asp-route-returnUrl="@ViewData["ReturnUrl"]" asp-action="LoginWith2fa">
<div class="twoFaBox">
<h2 class="h3 mb-3">Two-factor authentication</h2>
<form method="post" asp-route-returnUrl="@ViewData["ReturnUrl"]" asp-action="LoginWith2fa">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="RememberMe" type="hidden"/>
<div class="form-group">
@ -26,13 +22,9 @@
<button type="submit" class="btn btn-primary">Log in</button>
</div>
</form>
</div>
<div class="row">
<div class="col-12">
<p class="text-secondary">
<p class="text-secondary mt-4 mb-0">
Don't have access to your authenticator device?
<br>
You can <a asp-action="LoginWithRecoveryCode" asp-route-returnUrl="@ViewData["ReturnUrl"]">log in with a recovery code</a>.
</p>
</div>
</div>

View File

@ -1,15 +1,13 @@
@model BTCPayServer.Fido2.Models.LoginWithFido2ViewModel
<div class="twoFaBox">
<form id="fidoForm" asp-action="LoginWithFido2" method="post" asp-route-returnUrl="@ViewData["ReturnUrl"]">
<input type="hidden" asp-for="Data"/>
<input type="hidden" asp-for="Response"/>
<input type="hidden" asp-for="UserId"/>
<input type="hidden" asp-for="RememberMe"/>
</form>
<div class="row pt-5">
<div class="col-lg-12 section-heading">
<h2>FIDO2 Authentication</h2>
<h2 class="h3 mb-3">FIDO2 Authentication</h2>
<p>Insert your security device and proceed.</p>
<div id="info-message" class="alert alert-info mb-3 d-none">
<div class="d-flex align-items-center">
@ -20,8 +18,6 @@
<button id="btn-start" class="btn btn-primary d-none" type="button">Start</button>
<p id="error-message" class="d-none alert alert-danger"></p>
<button id="btn-retry" class="btn btn-secondary d-none" type="button">Retry</button>
</div>
</div>
<script>
document.getElementById('btn-retry').addEventListener('click', () => window.location.reload())
@ -30,3 +26,6 @@
</script>
<script src="~/js/webauthn/helpers.js" asp-append-version="true"></script>
<script src="~/js/webauthn/login.js" asp-append-version="true"></script>
</div>

View File

@ -7,11 +7,12 @@
};
}
<section class="pt-5" id="lnurlauth-section">
<div>
<div class="row">
<div class="col-lg-12 section-heading">
<h2>LNURL Auth</h2>
<div id="lnurlauth-section" class="twoFaBox">
<form id="authform" asp-action="LoginWithLNURLAuth" method="post" asp-route-returnUrl="@ViewData["ReturnUrl"]">
<input type="hidden" asp-for="LNURLEndpoint"/>
<input type="hidden" asp-for="UserId"/>
</form>
<h2 class="h3 mb-3">LNURL Auth</h2>
<div class="align-items-center">
<ul class="nav justify-content-center my-2">
@for (int i = 0; i < formats.Count; i++)
@ -43,14 +44,6 @@
<p>Scan the QR code with your lightning wallet and link to your user account.</p>
</div>
</div>
</div>
</div>
</section>
<form id="authform" asp-action="LoginWithLNURLAuth" method="post" asp-route-returnUrl="@ViewData["ReturnUrl"]">
<input type="hidden" asp-for="LNURLEndpoint"/>
<input type="hidden" asp-for="UserId"/>
</form>
<script>
function check() {

View File

@ -1,21 +1,14 @@
@model LoginWithRecoveryCodeViewModel
@{
Layout = "_LayoutSignedOut";
ViewData["Title"] = "Recovery code verification";
}
<div class="row">
<div class="col-lg-12 section-heading">
<h2>@ViewData["Title"]</h2>
<hr class="primary">
<p>
You have requested to login with a recovery code. This login will not be remembered until you provide
an authenticator app code at login or disable 2FA and login again.
</p>
</div>
</div>
<div class="row">
<form method="post" class="col-12">
<div asp-validation-summary="All" class="text-danger"></div>
<form method="post">
<div class="form-group">
<label asp-for="RecoveryCode" class="form-label"></label>
<input asp-for="RecoveryCode" class="form-control" autocomplete="off" />
@ -23,7 +16,6 @@
</div>
<button type="submit" class="btn btn-primary">Log in</button>
</form>
</div>
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />

View File

@ -1,6 +1,16 @@
@model SecondaryLoginViewModel
@{
ViewData["Title"] = "Two-factor/U2F authentication";
Layout = "_LayoutSignedOut";
ViewBag.ShowTitle = false;
}
@section PageHeadContent {
<style>.twoFaBox + .twoFaBox { margin-top: var(--btcpay-space-l); padding-top: var(--btcpay-space-l); border-top: 1px solid var(--btcpay-body-border-light); }</style>
}
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
}
@if (Model.LoginWith2FaViewModel != null && Model.LoginWithFido2ViewModel != null&& Model.LoginWithLNURLAuthViewModel != null)
@ -10,7 +20,7 @@
else if (Model.LoginWith2FaViewModel == null && Model.LoginWithFido2ViewModel == null && Model.LoginWithLNURLAuthViewModel == null)
{
<div class="row">
<div class="col-lg-12 section-heading">
<div class="col-lg-12">
<h2 class="bg-danger">2FA and U2F/FIDO2 and LNURL-Auth Authentication Methods are not available. Please go to the https endpoint.</h2>
<hr class="danger">
</div>
@ -20,24 +30,14 @@ else if (Model.LoginWith2FaViewModel == null && Model.LoginWithFido2ViewModel ==
<div class="row justify-content-center">
@if (Model.LoginWith2FaViewModel != null)
{
<div class="col-sm-12 col-md-6">
<partial name="LoginWith2fa" model="@Model.LoginWith2FaViewModel"/>
</div>
}
@if (Model.LoginWithFido2ViewModel != null)
{
<div class="col-sm-12 col-md-6">
<partial name="LoginWithFido2" model="@Model.LoginWithFido2ViewModel"/>
</div>
}
@if (Model.LoginWithLNURLAuthViewModel != null)
{
<div class="col-sm-12 col-md-6">
<partial name="LoginWithLNURLAuth" model="@Model.LoginWithLNURLAuthViewModel"/>
</div>
}
</div>
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
}