diff --git a/BTCPayServer/Controllers/UIAccountController.cs b/BTCPayServer/Controllers/UIAccountController.cs index 957d129db..ce1526358 100644 --- a/BTCPayServer/Controllers/UIAccountController.cs +++ b/BTCPayServer/Controllers/UIAccountController.cs @@ -257,8 +257,8 @@ namespace BTCPayServer.Controllers RememberMe = rememberMe, UserId = user.Id, LNURLEndpoint = new Uri(_linkGenerator.GetUriByAction( - action: nameof(LNURLAuthController.LoginResponse), - controller: "LNURLAuth", + action: nameof(UILNURLAuthController.LoginResponse), + controller: "UILNURLAuth", values: new { userId = user.Id, action="login", tag="login", k1= Encoders.Hex.EncodeData(r) }, Request.Scheme, Request.Host, Request.PathBase)) }; } diff --git a/BTCPayServer/Controllers/LNURLAuthController.cs b/BTCPayServer/Controllers/UILNURLAuthController.cs similarity index 92% rename from BTCPayServer/Controllers/LNURLAuthController.cs rename to BTCPayServer/Controllers/UILNURLAuthController.cs index 022ed13df..b36d935d0 100644 --- a/BTCPayServer/Controllers/LNURLAuthController.cs +++ b/BTCPayServer/Controllers/UILNURLAuthController.cs @@ -1,7 +1,9 @@ -using System; +using System; using System.Threading.Tasks; +using BTCPayServer.Abstractions.Constants; using BTCPayServer.Abstractions.Extensions; using BTCPayServer.Abstractions.Models; +using BTCPayServer.Client; using BTCPayServer.Data; using BTCPayServer.Models; using LNURL; @@ -16,14 +18,14 @@ using NBitcoin.DataEncoders; namespace BTCPayServer { [Route("lnurlauth")] - [Authorize] - public class LNURLAuthController : Controller + [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanViewProfile)] + public class UILNURLAuthController : Controller { private readonly UserManager _userManager; private readonly LnurlAuthService _lnurlAuthService; private readonly LinkGenerator _linkGenerator; - public LNURLAuthController(UserManager userManager, LnurlAuthService lnurlAuthService, + public UILNURLAuthController(UserManager userManager, LnurlAuthService lnurlAuthService, LinkGenerator linkGenerator) { _userManager = userManager; @@ -71,7 +73,7 @@ namespace BTCPayServer return View(new Uri(_linkGenerator.GetUriByAction( action: nameof(CreateResponse), - controller: "LNURLAuth", + controller: "UILNURLAuth", values: new { userId, diff --git a/BTCPayServer/Controllers/UIManageController.2FA.cs b/BTCPayServer/Controllers/UIManageController.2FA.cs index 46a2656b9..c48bc1ee0 100644 --- a/BTCPayServer/Controllers/UIManageController.2FA.cs +++ b/BTCPayServer/Controllers/UIManageController.2FA.cs @@ -189,7 +189,7 @@ namespace BTCPayServer.Controllers case Fido2Credential.CredentialType.FIDO2: return RedirectToAction("Create", "UIFido2", new { name }); case Fido2Credential.CredentialType.LNURLAuth: - return RedirectToAction("Create", "LNURLAuth", new { name }); + return RedirectToAction("Create", "UILNURLAuth", new { name }); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } diff --git a/BTCPayServer/Views/UIAccount/LoginWithLNURLAuth.cshtml b/BTCPayServer/Views/UIAccount/LoginWithLNURLAuth.cshtml index d25c4275d..0fcf3e6be 100644 --- a/BTCPayServer/Views/UIAccount/LoginWithLNURLAuth.cshtml +++ b/BTCPayServer/Views/UIAccount/LoginWithLNURLAuth.cshtml @@ -62,7 +62,7 @@ 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()); } check(); diff --git a/BTCPayServer/Views/LNURLAuth/Create.cshtml b/BTCPayServer/Views/UILNURLAuth/Create.cshtml similarity index 100% rename from BTCPayServer/Views/LNURLAuth/Create.cshtml rename to BTCPayServer/Views/UILNURLAuth/Create.cshtml diff --git a/BTCPayServer/Views/LNURLAuth/_ViewImports.cshtml b/BTCPayServer/Views/UILNURLAuth/_ViewImports.cshtml similarity index 100% rename from BTCPayServer/Views/LNURLAuth/_ViewImports.cshtml rename to BTCPayServer/Views/UILNURLAuth/_ViewImports.cshtml diff --git a/BTCPayServer/Views/LNURLAuth/_ViewStart.cshtml b/BTCPayServer/Views/UILNURLAuth/_ViewStart.cshtml similarity index 100% rename from BTCPayServer/Views/LNURLAuth/_ViewStart.cshtml rename to BTCPayServer/Views/UILNURLAuth/_ViewStart.cshtml diff --git a/BTCPayServer/Views/UIManage/TwoFactorAuthentication.cshtml b/BTCPayServer/Views/UIManage/TwoFactorAuthentication.cshtml index 41d1e6ca1..fe7fad97c 100644 --- a/BTCPayServer/Views/UIManage/TwoFactorAuthentication.cshtml +++ b/BTCPayServer/Views/UIManage/TwoFactorAuthentication.cshtml @@ -122,7 +122,7 @@ } else if (device.Type == Fido2Credential.CredentialType.LNURLAuth) { - Remove + Remove } }