Merge pull request #1814 from dennisreimann/seed-confirm-setting

Remove confirm option for seed from wallet settings
This commit is contained in:
Nicolas Dorier 2020-08-10 22:37:44 +09:00 committed by GitHub
commit 111cdbd4dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 9 deletions

View File

@ -664,6 +664,7 @@ namespace BTCPayServer.Tests
Assert.Equal(parsedBip21.Address.ToString(), s.Driver.FindElement(By.Id($"Outputs_0__DestinationAddress")).GetAttribute("value"));
s.GoToWallet(new WalletId(storeId.storeId, "BTC"), WalletsNavPages.Settings);
var walletUrl = s.Driver.Url;
s.Driver.FindElement(By.Id("SettingsMenu")).ForceClick();
s.Driver.FindElement(By.CssSelector("button[value=view-seed]")).Click();
@ -671,7 +672,12 @@ namespace BTCPayServer.Tests
// Seed backup page
var recoveryPhrase = s.Driver.FindElements(By.Id("recovery-phrase")).First().GetAttribute("data-mnemonic");
Assert.Equal(mnemonic.ToString(), recoveryPhrase);
Assert.Contains("The recovery phrase will also be stored on a server as a hot wallet.", s.Driver.PageSource);
Assert.Contains("The recovery phrase will also be stored on the server as a hot wallet.", s.Driver.PageSource);
// No confirmation, just a link to return to the wallet
Assert.Empty(s.Driver.FindElements(By.Id("confirm")));
s.Driver.FindElement(By.Id("proceed")).Click();
Assert.Equal(walletUrl, s.Driver.Url);
}
}
void SetTransactionOutput(SeleniumTester s, int index, BitcoinAddress dest, decimal amount, bool subtract = false)

View File

@ -1160,6 +1160,7 @@ namespace BTCPayServer.Controllers
CryptoCode = walletId.CryptoCode,
Mnemonic = seed,
IsStored = true,
RequireConfirm = false,
ReturnUrl = Url.Action(nameof(WalletSettings), new { walletId })
};
return this.RedirectToRecoverySeedBackup(recoveryVm);

View File

@ -445,6 +445,7 @@ namespace BTCPayServer
new KeyValuePair<string, string>("mnemonic", vm.Mnemonic),
new KeyValuePair<string, string>("passphrase", vm.Passphrase),
new KeyValuePair<string, string>("isStored", vm.IsStored ? "true" : "false"),
new KeyValuePair<string, string>("requireConfirm", vm.RequireConfirm ? "true" : "false"),
new KeyValuePair<string, string>("returnUrl", vm.ReturnUrl)
}
};

View File

@ -10,8 +10,9 @@ namespace BTCPayServer.Models.StoreViewModels
public string CryptoCode { get; set; }
public string Mnemonic { get; set; }
public string Passphrase { get; set; }
public bool IsStored { get; set; }
public string ReturnUrl { get; set; }
public bool IsStored { get; set; }
public bool RequireConfirm { get; set; } = true;
public string[] Words
{

View File

@ -46,7 +46,7 @@
Do not photograph it. Do not store it digitally.
</p>
<p>
<strong>The recovery phrase will also be stored on a server as a hot wallet.</strong>
<strong>The recovery phrase will also be stored on the server as a hot wallet.</strong>
</p>
}
else
@ -65,11 +65,18 @@
<p class="mt-3 mb-0">Please make sure to also write down your passphrase.</p>
}
</div>
<form id="recovery-confirmation" action="@Model.ReturnUrl" class="d-flex align-items-start justify-content-center" style="margin-top:4rem;padding-bottom: 80px">
<label class="form-check-label lead order-2" for="confirm">I have written down my recovery phrase and stored it in a secure location</label>
<input type="checkbox" class="mt-2 mr-3 order-1" id="confirm">
<button type="submit" class="btn btn-primary btn-lg px-5 order-3" id="submit">Done</button>
<button type="submit" class="btn btn-primary btn-lg px-5 order-3" disabled>Done</button>
</form>
@if (Model.RequireConfirm)
{
<form id="recovery-confirmation" action="@Model.ReturnUrl" class="d-flex align-items-start justify-content-center" style="margin-top:4rem;padding-bottom: 80px">
<label class="form-check-label lead order-2" for="confirm">I have written down my recovery phrase and stored it in a secure location</label>
<input type="checkbox" class="mt-2 mr-3 order-1" id="confirm">
<button type="submit" class="btn btn-primary btn-lg px-5 order-3" id="submit">Done</button>
<button type="submit" class="btn btn-primary btn-lg px-5 order-3" disabled>Done</button>
</form>
}
else
{
<a href="@Model.ReturnUrl" class="btn btn-primary btn-lg mt-3 px-5 order-3" id="proceed">Done</a>
}
</div>
</div>