mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 02:28:31 +01:00
53 lines
2.1 KiB
Plaintext
53 lines
2.1 KiB
Plaintext
@model BTCPayServer.U2F.Models.LoginWithU2FViewModel
|
|
|
|
<form id="u2fForm" asp-action="LoginWithU2F" method="post" asp-route-returnUrl="@ViewData["ReturnUrl"]">
|
|
<input type="hidden" asp-for="Version" />
|
|
<input type="hidden" asp-for="Challenge" />
|
|
<input type="hidden" asp-for="AppId" />
|
|
<input type="hidden" asp-for="DeviceResponse" />
|
|
@for (int i = 0; i < Model.Challenges.Count; i++)
|
|
{
|
|
@Html.HiddenFor(m => m.Challenges[i])
|
|
}
|
|
<input type="hidden" asp-for="UserId" />
|
|
<input type="hidden" asp-for="RememberMe" />
|
|
</form>
|
|
|
|
<section class="pt-5">
|
|
<div>
|
|
<div class="row">
|
|
<div class="col-lg-12 section-heading">
|
|
<h2>U2F Authentication</h2>
|
|
<hr class="primary">
|
|
<div>
|
|
<span id="spinner" class="fa fa-spinner fa-spin float-right ml-3 mr-5 mt-1" style="font-size:2.5em"></span>
|
|
<p>Insert your U2F device or hardware wallet into your computer's USB port. If it has a button, tap on it.</p>
|
|
</div>
|
|
<p id="error-message" class="d-none alert alert-danger"></p>
|
|
<a id="btn-retry" class="btn btn-secondary d-none" href="javascript:window.location.reload()">Retry</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<script src="~/vendor/u2f/u2f-api-1.1.1.js" asp-append-version="true"></script>
|
|
<script type="text/javascript">
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
window.u2fApi.sign(
|
|
@Safe.Json(Model.Challenges)
|
|
)
|
|
.then(data => {
|
|
document.getElementById("DeviceResponse").value = JSON.stringify(data);
|
|
document.getElementById("u2fForm").submit();
|
|
})
|
|
.catch(error => {
|
|
document.getElementById("error-message").innerText = error.message;
|
|
document.getElementById("error-message").classList.remove("d-none");
|
|
document.getElementById("spinner").classList.add("d-none");
|
|
if (!error.message.endsWith("not supported")) {
|
|
document.getElementById("btn-retry").classList.remove("d-none");
|
|
}
|
|
});
|
|
});
|
|
</script>
|