Rename LNUrlAuthController -> UILNAuthController (#3352)

This commit is contained in:
Nicolas Dorier
2022-01-25 11:51:14 +09:00
committed by GitHub
parent c62018f984
commit a8adac9c5a
8 changed files with 12 additions and 10 deletions

View File

@@ -257,8 +257,8 @@ namespace BTCPayServer.Controllers
RememberMe = rememberMe, RememberMe = rememberMe,
UserId = user.Id, UserId = user.Id,
LNURLEndpoint = new Uri(_linkGenerator.GetUriByAction( LNURLEndpoint = new Uri(_linkGenerator.GetUriByAction(
action: nameof(LNURLAuthController.LoginResponse), action: nameof(UILNURLAuthController.LoginResponse),
controller: "LNURLAuth", controller: "UILNURLAuth",
values: new { userId = user.Id, action="login", tag="login", k1= Encoders.Hex.EncodeData(r) }, Request.Scheme, Request.Host, Request.PathBase)) values: new { userId = user.Id, action="login", tag="login", k1= Encoders.Hex.EncodeData(r) }, Request.Scheme, Request.Host, Request.PathBase))
}; };
} }

View File

@@ -1,7 +1,9 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions; using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models; using BTCPayServer.Abstractions.Models;
using BTCPayServer.Client;
using BTCPayServer.Data; using BTCPayServer.Data;
using BTCPayServer.Models; using BTCPayServer.Models;
using LNURL; using LNURL;
@@ -16,14 +18,14 @@ using NBitcoin.DataEncoders;
namespace BTCPayServer namespace BTCPayServer
{ {
[Route("lnurlauth")] [Route("lnurlauth")]
[Authorize] [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanViewProfile)]
public class LNURLAuthController : Controller public class UILNURLAuthController : Controller
{ {
private readonly UserManager<ApplicationUser> _userManager; private readonly UserManager<ApplicationUser> _userManager;
private readonly LnurlAuthService _lnurlAuthService; private readonly LnurlAuthService _lnurlAuthService;
private readonly LinkGenerator _linkGenerator; private readonly LinkGenerator _linkGenerator;
public LNURLAuthController(UserManager<ApplicationUser> userManager, LnurlAuthService lnurlAuthService, public UILNURLAuthController(UserManager<ApplicationUser> userManager, LnurlAuthService lnurlAuthService,
LinkGenerator linkGenerator) LinkGenerator linkGenerator)
{ {
_userManager = userManager; _userManager = userManager;
@@ -71,7 +73,7 @@ namespace BTCPayServer
return View(new Uri(_linkGenerator.GetUriByAction( return View(new Uri(_linkGenerator.GetUriByAction(
action: nameof(CreateResponse), action: nameof(CreateResponse),
controller: "LNURLAuth", controller: "UILNURLAuth",
values: new values: new
{ {
userId, userId,

View File

@@ -189,7 +189,7 @@ namespace BTCPayServer.Controllers
case Fido2Credential.CredentialType.FIDO2: case Fido2Credential.CredentialType.FIDO2:
return RedirectToAction("Create", "UIFido2", new { name }); return RedirectToAction("Create", "UIFido2", new { name });
case Fido2Credential.CredentialType.LNURLAuth: case Fido2Credential.CredentialType.LNURLAuth:
return RedirectToAction("Create", "LNURLAuth", new { name }); return RedirectToAction("Create", "UILNURLAuth", new { name });
default: default:
throw new ArgumentOutOfRangeException(nameof(type), type, null); throw new ArgumentOutOfRangeException(nameof(type), type, null);
} }

View File

@@ -62,7 +62,7 @@
document.getElementById("authform").submit(); document.getElementById("authform").submit();
} }
} }
request.open("GET", @Safe.Json(Url.Action("LoginCheck", "LNURLAuth", new { userId = Model.UserId })), true); request.open("GET", @Safe.Json(Url.Action("LoginCheck", "UILNURLAuth", new { userId = Model.UserId })), true);
request.send(new FormData()); request.send(new FormData());
} }
check(); check();

View File

@@ -122,7 +122,7 @@
} }
else if (device.Type == Fido2Credential.CredentialType.LNURLAuth) else if (device.Type == Fido2Credential.CredentialType.LNURLAuth)
{ {
<a asp-controller="LNURLAuth" asp-action="Remove" asp-route-id="@device.Id" class="btn btn-outline-danger" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-title="Remove Lightning security" data-description="Your account will no longer be linked to the lightning node <strong>@name</strong> as an option for two-factor authentication." data-confirm="Remove" data-confirm-input="REMOVE">Remove</a> <a asp-controller="UILNURLAuth" asp-action="Remove" asp-route-id="@device.Id" class="btn btn-outline-danger" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-title="Remove Lightning security" data-description="Your account will no longer be linked to the lightning node <strong>@name</strong> as an option for two-factor authentication." data-confirm="Remove" data-confirm-input="REMOVE">Remove</a>
} }
</div> </div>
} }