Unify get and post routes for create user

This commit is contained in:
Dennis Reimann 2020-07-13 19:08:47 +02:00
parent ea8f121cb0
commit 0235624c64
No known key found for this signature in database
GPG Key ID: 5009E1797F03F8D0
3 changed files with 7 additions and 7 deletions

View File

@ -307,14 +307,14 @@ namespace BTCPayServer.Controllers
[Route("server/users/new")]
[HttpGet]
public IActionResult NewUser()
public IActionResult CreateUser()
{
ViewData["AllowIsAdmin"] = _Options.AllowAdminRegistration;
return View();
}
[Route("server/users")]
[Route("server/users/new")]
[HttpPost]
public async Task<IActionResult> CreateUser(RegisterViewModel model)
{
@ -337,7 +337,7 @@ namespace BTCPayServer.Controllers
}
// If we got this far, something failed, redisplay form
return View("NewUser", model);
return View(model);
}
[Route("server/users/{userId}/delete")]

View File

@ -30,9 +30,9 @@
@if (ViewData["AllowIsAdmin"] is true)
{
<div class="form-group">
<label asp-for="IsAdmin"></label>
<input asp-for="IsAdmin" type="checkbox" class="form-check-inline"/>
<div class="form-group form-check">
<input asp-for="IsAdmin" type="checkbox" class="form-check-input"/>
<label asp-for="IsAdmin" class="form-check-label"></label>
<span asp-validation-for="IsAdmin" class="text-danger"></span>
</div>
}

View File

@ -9,7 +9,7 @@
<div class="col-lg-9 col-xl-8">
<span>Total Users: @Model.Total</span>
<span class="pull-right">
<a asp-action="NewUser" class="btn btn-primary" role="button">
<a asp-action="CreateUser" class="btn btn-primary" role="button">
<span class="fa fa-plus"></span> Add User
</a>
</span>