Remove unreachable code (#2961)

This commit is contained in:
Nicolas Dorier
2021-10-15 16:34:40 +09:00
committed by GitHub
parent 843a2491ef
commit 9df4429fc2
2 changed files with 2 additions and 11 deletions

View File

@@ -242,22 +242,13 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(SetPassword));
}
[HttpGet()]
public IActionResult DeleteUser()
{
return View("Confirm", new ConfirmModel("Delete account", "Your account will be permanently deleted. This action will also delete all stores, invoices, apps and data associated with your account.", "Delete")
{
ActionUrl = "DeleteUserPost"
});
}
[HttpPost()]
public async Task<IActionResult> DeleteUserPost()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
return NotFound();
}
await _userService.DeleteUserAndAssociatedData(user);

View File

@@ -41,7 +41,7 @@
See more actions
</button>
<div id="danger-zone" class="collapse">
<a id="delete-user" class="btn btn-outline-danger mb-5" asp-action="DeleteUser" data-confirm-input="DELETE" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-action="DeleteUserPost" data-description="This action will also delete all stores, invoices, apps and data associated with the user.">Delete your user.</a>
<a id="delete-user" class="btn btn-outline-danger mb-5" data-confirm-input="DELETE" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-action="DeleteUserPost" data-description="This action will also delete all stores, invoices, apps and data associated with the user.">Delete your user.</a>
</div>
</form>