diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index dc68d68bb5..a6bb5fb298 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -203,7 +203,6 @@ public Mnemonic GenerateWallet(string cryptoCode = "BTC", string seed = "", bool { var isImport = !string.IsNullOrEmpty(seed); GoToWalletSettings(cryptoCode); - // Replace previous wallet case if (Driver.PageSource.Contains("id=\"ChangeWalletLink\"")) { diff --git a/BTCPayServer/Extensions/UrlHelperExtensions.cs b/BTCPayServer/Extensions/UrlHelperExtensions.cs index 0dafbf989c..70426808e4 100644 --- a/BTCPayServer/Extensions/UrlHelperExtensions.cs +++ b/BTCPayServer/Extensions/UrlHelperExtensions.cs @@ -1,4 +1,5 @@ +using System; using BTCPayServer; using BTCPayServer.Client.Models; using BTCPayServer.Controllers; @@ -10,6 +11,18 @@ namespace Microsoft.AspNetCore.Mvc { public static class UrlHelperExtensions { +#nullable enable + public static string? EnsureLocal(this IUrlHelper helper, string? url, HttpRequest? httpRequest = null) + { + if (url is null || helper.IsLocalUrl(url)) + return url; + if (httpRequest is null) + return null; + if (Uri.TryCreate(url, UriKind.Absolute, out var r) && r.Host.Equals(httpRequest.Host.Host)) + return url; + return null; + } +#nullable restore public static string EmailConfirmationLink(this LinkGenerator urlHelper, string userId, string code, string scheme, HostString host, string pathbase) { return urlHelper.GetUriByAction(nameof(UIAccountController.ConfirmEmail), "UIAccount", diff --git a/BTCPayServer/Models/StoreViewModels/RecoverySeedBackupViewModel.cs b/BTCPayServer/Models/StoreViewModels/RecoverySeedBackupViewModel.cs index 1b7f58ccce..412b5c1f97 100644 --- a/BTCPayServer/Models/StoreViewModels/RecoverySeedBackupViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/RecoverySeedBackupViewModel.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Http; @@ -16,7 +17,7 @@ public class RecoverySeedBackupViewModel public string[] Words { - get => Mnemonic.Split((char[])null, System.StringSplitOptions.RemoveEmptyEntries); + get => Mnemonic?.Split((char[])null, System.StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty(); } } } diff --git a/BTCPayServer/Views/Shared/ConfirmModal.cshtml b/BTCPayServer/Views/Shared/ConfirmModal.cshtml index 8549f8a66b..5658f64bfb 100644 --- a/BTCPayServer/Views/Shared/ConfirmModal.cshtml +++ b/BTCPayServer/Views/Shared/ConfirmModal.cshtml @@ -32,7 +32,7 @@ @if (!string.IsNullOrEmpty(Model.Action)) { -
+ @if (Model.RequireConfirm) { - + @@ -82,7 +82,7 @@ } else { - Done + Done } diff --git a/BTCPayServer/Views/UIStores/WalletSettings.cshtml b/BTCPayServer/Views/UIStores/WalletSettings.cshtml index 746eafe94c..fcbea8507c 100644 --- a/BTCPayServer/Views/UIStores/WalletSettings.cshtml +++ b/BTCPayServer/Views/UIStores/WalletSettings.cshtml @@ -52,7 +52,7 @@ data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-title="Replace @Model.CryptoCode wallet" - data-description="@Html.Encode(ViewData["ReplaceDescription"])" + data-description="@ViewData["ReplaceDescription"]" data-confirm="Setup new wallet" data-confirm-input="REPLACE"> Replace wallet @@ -64,7 +64,7 @@ data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-title="Remove @Model.CryptoCode wallet" - data-description="@Html.Encode(ViewData["RemoveDescription"])" + data-description="@ViewData["RemoveDescription"]" data-confirm="Remove" data-confirm-input="REMOVE">Remove wallet
diff --git a/BTCPayServer/Views/UIWallets/SignWithSeed.cshtml b/BTCPayServer/Views/UIWallets/SignWithSeed.cshtml index e68d8c2df9..bc1e73ddac 100644 --- a/BTCPayServer/Views/UIWallets/SignWithSeed.cshtml +++ b/BTCPayServer/Views/UIWallets/SignWithSeed.cshtml @@ -11,11 +11,11 @@ @section Navbar { @if (backUrl != null) { - + } - + } diff --git a/BTCPayServer/Views/UIWallets/WalletPSBT.cshtml b/BTCPayServer/Views/UIWallets/WalletPSBT.cshtml index 08507f37ab..95a69e9a10 100644 --- a/BTCPayServer/Views/UIWallets/WalletPSBT.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletPSBT.cshtml @@ -11,11 +11,11 @@ @section Navbar { @if (backUrl != null) { - + } - + } diff --git a/BTCPayServer/Views/UIWallets/WalletPSBTCombine.cshtml b/BTCPayServer/Views/UIWallets/WalletPSBTCombine.cshtml index 9e66b1fab7..cf340e054e 100644 --- a/BTCPayServer/Views/UIWallets/WalletPSBTCombine.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletPSBTCombine.cshtml @@ -11,11 +11,11 @@ @section Navbar { @if (backUrl != null) { - + } - + } diff --git a/BTCPayServer/Views/UIWallets/WalletPSBTDecoded.cshtml b/BTCPayServer/Views/UIWallets/WalletPSBTDecoded.cshtml index 06ad3b0334..30757ad273 100644 --- a/BTCPayServer/Views/UIWallets/WalletPSBTDecoded.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletPSBTDecoded.cshtml @@ -75,11 +75,11 @@ @section Navbar { @if (backUrl != null) { - + } - + } diff --git a/BTCPayServer/Views/UIWallets/WalletReceive.cshtml b/BTCPayServer/Views/UIWallets/WalletReceive.cshtml index 8841e47136..184725eb39 100644 --- a/BTCPayServer/Views/UIWallets/WalletReceive.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletReceive.cshtml @@ -1,4 +1,4 @@ -@inject BTCPayServer.Services.BTCPayServerEnvironment env +@inject BTCPayServer.Services.BTCPayServerEnvironment env @using BTCPayServer.Controllers @using BTCPayServer.Components.QRCode @model BTCPayServer.Controllers.WalletReceiveViewModel @@ -15,7 +15,7 @@ } @section Navbar { - + } diff --git a/BTCPayServer/Views/UIWallets/WalletSend.cshtml b/BTCPayServer/Views/UIWallets/WalletSend.cshtml index 25551fbae7..8b2e4ca733 100644 --- a/BTCPayServer/Views/UIWallets/WalletSend.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletSend.cshtml @@ -14,11 +14,11 @@ @section Navbar { @if (backUrl != null) { - + } - + } diff --git a/BTCPayServer/Views/UIWallets/WalletSendVault.cshtml b/BTCPayServer/Views/UIWallets/WalletSendVault.cshtml index 394998319a..184e34081b 100644 --- a/BTCPayServer/Views/UIWallets/WalletSendVault.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletSendVault.cshtml @@ -11,11 +11,11 @@ @section Navbar { @if (backUrl != null) { - + } - + } diff --git a/BTCPayServer/Views/UIWallets/WalletSigningOptions.cshtml b/BTCPayServer/Views/UIWallets/WalletSigningOptions.cshtml index 0e2bae8710..2c4652a49a 100644 --- a/BTCPayServer/Views/UIWallets/WalletSigningOptions.cshtml +++ b/BTCPayServer/Views/UIWallets/WalletSigningOptions.cshtml @@ -12,11 +12,11 @@ @section Navbar { @if (backUrl != null) { - + } - + }