fixes user's auto-deletion :-)

This commit is contained in:
2019-07-21 02:54:16 +02:00
parent c01fae9c3a
commit 7143c1feeb
3 changed files with 6 additions and 1 deletions

View File

@ -1,8 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ViewModels.Account namespace Yavsc.ViewModels.Account
{ {
public class UnregisterViewModel public class UnregisterViewModel
{ {
[Required]
public string UserId { get; set; } public string UserId { get; set; }
public string ReturnUrl { get; set; } public string ReturnUrl { get; set; }
} }

View File

@ -687,7 +687,7 @@ namespace Yavsc.Controllers
[HttpGet, Authorize] [HttpGet, Authorize]
public IActionResult Delete() public IActionResult Delete()
{ {
return View(); return View(new UnregisterViewModel { UserId = User.GetUserId() });
} }
[HttpGet, Authorize("AdministratorOnly")] [HttpGet, Authorize("AdministratorOnly")]

View File

@ -8,6 +8,7 @@
<form asp-controller="Account" asp-action="Delete" method="post" class="form-horizontal" role="form"> <form asp-controller="Account" asp-action="Delete" method="post" class="form-horizontal" role="form">
@Html.Hidden("ReturnUrl") @Html.Hidden("ReturnUrl")
@Html.Hidden("UserId")
<input type="submit" value="@SR["Unregister"]" class="btn btn-default"/> <input type="submit" value="@SR["Unregister"]" class="btn btn-default"/>
</form> </form>