diff --git a/Streetwriters.Common/Constants.cs b/Streetwriters.Common/Constants.cs index 33adcbc..634c09e 100644 --- a/Streetwriters.Common/Constants.cs +++ b/Streetwriters.Common/Constants.cs @@ -24,6 +24,7 @@ namespace Streetwriters.Common public class Constants { public static bool IS_SELF_HOSTED => Environment.GetEnvironmentVariable("SELF_HOSTED") == "1"; + public static bool DISABLE_ACCOUNT_CREATION => Environment.GetEnvironmentVariable("DISABLE_ACCOUNT_CREATION") == "1"; // S3 related public static string S3_ACCESS_KEY => Environment.GetEnvironmentVariable("S3_ACCESS_KEY"); diff --git a/Streetwriters.Identity/Controllers/SignupController.cs b/Streetwriters.Identity/Controllers/SignupController.cs index dee3392..2ea1997 100644 --- a/Streetwriters.Identity/Controllers/SignupController.cs +++ b/Streetwriters.Identity/Controllers/SignupController.cs @@ -53,6 +53,8 @@ namespace Streetwriters.Identity.Controllers [AllowAnonymous] public async Task Signup([FromForm] SignupForm form) { + if (Constants.DISABLE_ACCOUNT_CREATION) + return BadRequest(new string[] { "Creating new accounts is not allowed." }); try { var client = Clients.FindClientById(form.ClientId); @@ -106,7 +108,6 @@ namespace Streetwriters.Identity.Controllers if (Constants.IS_SELF_HOSTED) { await UserManager.AddClaimAsync(user, UserService.SubscriptionTypeToClaim(client.Id, Common.Enums.SubscriptionType.PREMIUM)); - await MFAService.EnableMFAAsync(user, MFAMethods.Email); } else {