From 375c7060296b312dfea5c0e0d41f7d9c29fa0114 Mon Sep 17 00:00:00 2001 From: Pavel Vesely Date: Tue, 28 Apr 2020 14:51:27 +0200 Subject: [PATCH] Get custom theme and layout on a default install --- Oqtane.Client/UI/Installer.razor | 23 ------------------- .../Controllers/InstallationController.cs | 1 + .../Infrastructure/DatabaseManager.cs | 2 +- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/Oqtane.Client/UI/Installer.razor b/Oqtane.Client/UI/Installer.razor index bc537880..c20459b3 100644 --- a/Oqtane.Client/UI/Installer.razor +++ b/Oqtane.Client/UI/Installer.razor @@ -179,31 +179,8 @@ }; var installation = await InstallationService.Install(config); - //TODO: Should be moved to Database manager if (installation.Success) { - Site site = new Site(); - site.TenantId = -1; // will be populated on server - site.Name = "Default Site"; - site.LogoFileId = null; - site.FaviconFileId = null; - site.DefaultThemeType = Constants.DefaultTheme; - site.DefaultLayoutType = Constants.DefaultLayout; - site.DefaultContainerType = Constants.DefaultContainer; - site.PwaIsEnabled = false; - site.PwaAppIconFileId = null; - site.PwaSplashIconFileId = null; - site.AllowRegistration = false; - site = await SiteService.AddSiteAsync(site, null); - - User user = new User(); - user.SiteId = site.SiteId; - user.Username = _hostUsername; - user.Password = _hostPassword; - user.Email = _hostEmail; - user.DisplayName = _hostUsername; - user = await UserService.AddUserAsync(user); - NavigationManager.NavigateTo("", true); } else diff --git a/Oqtane.Server/Controllers/InstallationController.cs b/Oqtane.Server/Controllers/InstallationController.cs index c812c47e..713d065a 100644 --- a/Oqtane.Server/Controllers/InstallationController.cs +++ b/Oqtane.Server/Controllers/InstallationController.cs @@ -44,6 +44,7 @@ namespace Oqtane.Controllers _config.Reload(); } + _databaseManager.BuildDefaultSite(config.Password, config.HostEmail); installation.Success = true; return installation; } diff --git a/Oqtane.Server/Infrastructure/DatabaseManager.cs b/Oqtane.Server/Infrastructure/DatabaseManager.cs index bffd2f7f..a896a337 100644 --- a/Oqtane.Server/Infrastructure/DatabaseManager.cs +++ b/Oqtane.Server/Infrastructure/DatabaseManager.cs @@ -315,7 +315,7 @@ namespace Oqtane.Infrastructure } } - private void BuildDefaultSite(string password, string email) + public void BuildDefaultSite(string password, string email) { using (var scope = _serviceScopeFactory.CreateScope()) {