From 32e66433035712f1683e1f3d92d87dfab777fa09 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 8 Oct 2020 11:56:58 +0900 Subject: [PATCH] Do not ignore IsAdmin settings when creating a new user via the Users page (Fix #1954) --- BTCPayServer/Controllers/ServerController.Users.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/BTCPayServer/Controllers/ServerController.Users.cs b/BTCPayServer/Controllers/ServerController.Users.cs index bcb4b5928..a3020e2a9 100644 --- a/BTCPayServer/Controllers/ServerController.Users.cs +++ b/BTCPayServer/Controllers/ServerController.Users.cs @@ -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 {