diff --git a/Lombiq.Hosting.Tenants.Admin.Login/Controllers/TenantLoginController.cs b/Lombiq.Hosting.Tenants.Admin.Login/Controllers/TenantLoginController.cs index ed086af8..d7a7afc3 100644 --- a/Lombiq.Hosting.Tenants.Admin.Login/Controllers/TenantLoginController.cs +++ b/Lombiq.Hosting.Tenants.Admin.Login/Controllers/TenantLoginController.cs @@ -50,6 +50,8 @@ public TenantLoginController( [IgnoreAntiforgeryToken] public async Task Index(string password) { + if (!ModelState.IsValid) return BadRequest(ModelState); + if (_shellSettings.Name.EqualsOrdinalIgnoreCase(ShellSettings.DefaultShellName)) { return NotFound(); diff --git a/Lombiq.Hosting.Tenants.Admin.Login/Permissions/TenantAdminPermissions.cs b/Lombiq.Hosting.Tenants.Admin.Login/Permissions/TenantAdminPermissions.cs index dde2abad..823d71ea 100644 --- a/Lombiq.Hosting.Tenants.Admin.Login/Permissions/TenantAdminPermissions.cs +++ b/Lombiq.Hosting.Tenants.Admin.Login/Permissions/TenantAdminPermissions.cs @@ -9,5 +9,5 @@ public class TenantAdminPermissions : AdminPermissionBase public static readonly Permission LoginAsAdmin = new(nameof(LoginAsAdmin), "Able to login as an admin to any tenant from the Default tenant."); - protected override IEnumerable AdminPermissions => new[] { LoginAsAdmin }; + protected override IEnumerable AdminPermissions => [LoginAsAdmin]; } diff --git a/Lombiq.Hosting.Tenants.FeaturesGuard/Extensions/OrchardCoreBuilderExtensions.cs b/Lombiq.Hosting.Tenants.FeaturesGuard/Extensions/OrchardCoreBuilderExtensions.cs index 643d9c56..0b56d389 100644 --- a/Lombiq.Hosting.Tenants.FeaturesGuard/Extensions/OrchardCoreBuilderExtensions.cs +++ b/Lombiq.Hosting.Tenants.FeaturesGuard/Extensions/OrchardCoreBuilderExtensions.cs @@ -14,7 +14,7 @@ public static OrchardCoreBuilder ConfigureFeaturesGuardForAzureStorage(this Orch builder.ConfigureFeaturesGuardWithoutOverriding( new Dictionary> { - ["OrchardCore.Media.Azure.Storage"] = new List { "OrchardCore.Media" }, + ["OrchardCore.Media.Azure.Storage"] = ["OrchardCore.Media"], }); /// @@ -26,7 +26,7 @@ public static OrchardCoreBuilder ConfigureFeaturesGuardForElasticsearch(this Orc new Dictionary> { ["OrchardCore.Search.Elasticsearch"] = - new List { "OrchardCore.Search", "OrchardCore.Indexing" }, + ["OrchardCore.Search", "OrchardCore.Indexing"], }); /// @@ -37,7 +37,7 @@ public static OrchardCoreBuilder ConfigureFeaturesGuardForEmailQuota(this Orchar builder.ConfigureFeaturesGuardWithoutOverriding( new Dictionary> { - ["Lombiq.Hosting.Tenants.EmailQuotaManagement"] = new List { "OrchardCore.Email" }, + ["Lombiq.Hosting.Tenants.EmailQuotaManagement"] = ["OrchardCore.Email"], }); /// diff --git a/Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs b/Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs index 4e0d9a0a..b765382b 100644 --- a/Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs +++ b/Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs @@ -46,6 +46,8 @@ public ShellSettingsEditorController( [ValidateAntiForgeryToken] public async Task Edit(ShellSettingsEditorViewModel model) { + if (!ModelState.IsValid) return BadRequest(ModelState); + if (!await _authorizationService.AuthorizeAsync(User, ManageTenants) || !_shellHost.TryGetSettings(model.TenantId, out var shellSettings)) { diff --git a/Lombiq.Hosting.Tenants.Management/Settings/HideRecipesFromSetupOptions.cs b/Lombiq.Hosting.Tenants.Management/Settings/HideRecipesFromSetupOptions.cs index 677610dd..2e5f229e 100644 --- a/Lombiq.Hosting.Tenants.Management/Settings/HideRecipesFromSetupOptions.cs +++ b/Lombiq.Hosting.Tenants.Management/Settings/HideRecipesFromSetupOptions.cs @@ -5,5 +5,5 @@ namespace Lombiq.Hosting.Tenants.Management.Settings; public class HideRecipesFromSetupOptions { - public IEnumerable HiddenTags { get; set; } = new[] { HideFromSetupScreen }; + public IEnumerable HiddenTags { get; set; } = [HideFromSetupScreen]; }