Delete confirmation modals (#2614)

* Refactor confirm view: separate modal

* Add delete confirmation modals for apps and FIDO2

* Add delete confirmation modals for 2FA actions

* Add delete confirmation modals for api keys and webhooks

* Add delete confirmation modals for stores and store users

* Add delete confirmation modals for LND seed and SSH

* Add delete confirmation modals for rate rule scripting

* Test fixes and improvements

* Add delete confirmation modals for dynamic DNS

* Add delete confirmation modals for store access tokens

* Add confirmation modals for pull payment archiving

* Refactor confirm modal code

* Add confirmation input, update wording

* Update modal styles

* Upgrade ChromeDriver

* Simplify and unify confirmation input

* Test fixes

* Fix wording

* Add modals for wallet replace and removal
This commit is contained in:
d11n
2021-09-07 04:55:53 +02:00
committed by GitHub
parent 6d317937c7
commit 06db29dd43
36 changed files with 527 additions and 464 deletions

View File

@@ -34,34 +34,6 @@ namespace BTCPayServer.Controllers
return View(model);
}
[HttpGet]
public async Task<IActionResult> Disable2faWarning()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
}
if (!user.TwoFactorEnabled)
{
throw new ApplicationException(
$"Unexpected error occurred disabling 2FA for user with ID '{user.Id}'.");
}
return View("Confirm",
new ConfirmModel()
{
Title = $"Disable two-factor authentication (2FA)",
DescriptionHtml = true,
Description =
$"Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key used in an authenticator app you should <a href=\"{Url.Action(nameof(ResetAuthenticatorWarning))}\"> reset your authenticator keys</a>.",
Action = "Disable 2FA",
ActionUrl = Url.ActionLink(nameof(Disable2fa))
});
}
[HttpPost]
public async Task<IActionResult> Disable2fa()
{
var user = await _userManager.GetUserAsync(User);
@@ -134,21 +106,6 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(GenerateRecoveryCodes), new {confirm = false});
}
[HttpGet]
public IActionResult ResetAuthenticatorWarning()
{
return View("Confirm",
new ConfirmModel()
{
Title = $"Reset authenticator key",
Description =
$"This process disables 2FA until you verify your authenticator app and will also reset your 2FA recovery codes.{Environment.NewLine}If you do not complete your authenticator app configuration you may lose access to your account.",
Action = "Reset",
ActionUrl = Url.ActionLink(nameof(ResetAuthenticator))
});
}
[HttpPost]
public async Task<IActionResult> ResetAuthenticator()
{
var user = await _userManager.GetUserAsync(User);
@@ -164,25 +121,6 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(EnableAuthenticator));
}
[HttpGet]
public async Task<IActionResult> GenerateRecoveryCodes(bool confirm = true)
{
if (!confirm)
{
return await GenerateRecoveryCodes();
}
return View("Confirm",
new ConfirmModel()
{
Title = $"Are you sure you want to generate new recovery codes?",
Description = "Your existing recovery codes will no longer be valid!",
Action = "Generate",
ActionUrl = Url.ActionLink(nameof(GenerateRecoveryCodes))
});
}
[HttpPost]
public async Task<IActionResult> GenerateRecoveryCodes()
{
var recoveryCodes = (string[])TempData[RecoveryCodesKey];