mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Do not ignore IsAdmin settings when creating a new user via the Users page (Fix #1954)
This commit is contained in:
@@ -99,7 +99,8 @@ namespace BTCPayServer.Controllers
|
|||||||
{
|
{
|
||||||
ViewData["AllowIsAdmin"] = _Options.AllowAdminRegistration;
|
ViewData["AllowIsAdmin"] = _Options.AllowAdminRegistration;
|
||||||
ViewData["AllowRequestEmailConfirmation"] = _cssThemeManager.Policies.RequiresConfirmedEmail;
|
ViewData["AllowRequestEmailConfirmation"] = _cssThemeManager.Policies.RequiresConfirmedEmail;
|
||||||
|
if (!_Options.AllowAdminRegistration)
|
||||||
|
model.IsAdmin = false;
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
IdentityResult result;
|
IdentityResult result;
|
||||||
@@ -107,14 +108,7 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(model.Password))
|
if (!string.IsNullOrEmpty(model.Password))
|
||||||
{
|
{
|
||||||
|
|
||||||
result = await _UserManager.CreateAsync(user, model.Password);
|
result = await _UserManager.CreateAsync(user, model.Password);
|
||||||
|
|
||||||
if (result.Succeeded)
|
|
||||||
{
|
|
||||||
TempData[WellKnownTempData.SuccessMessage] = "Account created";
|
|
||||||
return RedirectToAction(nameof(ListUsers));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user