Do not ignore IsAdmin settings when creating a new user via the Users page (Fix #1954)

This commit is contained in:
nicolas.dorier 2020-10-08 11:56:58 +09:00
parent 5131d8d328
commit 32e6643303
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -99,7 +99,8 @@ namespace BTCPayServer.Controllers
{
ViewData["AllowIsAdmin"] = _Options.AllowAdminRegistration;
ViewData["AllowRequestEmailConfirmation"] = _cssThemeManager.Policies.RequiresConfirmedEmail;
if (!_Options.AllowAdminRegistration)
model.IsAdmin = false;
if (ModelState.IsValid)
{
IdentityResult result;
@ -107,14 +108,7 @@ namespace BTCPayServer.Controllers
if (!string.IsNullOrEmpty(model.Password))
{
result = await _UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
TempData[WellKnownTempData.SuccessMessage] = "Account created";
return RedirectToAction(nameof(ListUsers));
}
}
else
{