public async Task UpdateAllSettings(HostSettingsEditDto input)
        {
            await this.SettingManager.ChangeSettingForApplicationAsync("App.General.WebSiteRootAddress", input.General.WebSiteRootAddress.EnsureEndsWith('/'));

            ISettingManager settingManager = this.SettingManager;
            bool            isEmailConfirmationRequiredForLogin = input.UserManagement.IsEmailConfirmationRequiredForLogin;
            await settingManager.ChangeSettingForApplicationAsync("Abp.Zero.UserManagement.IsEmailConfirmationRequiredForLogin", isEmailConfirmationRequiredForLogin.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            await this.SettingManager.ChangeSettingForApplicationAsync("Abp.Net.Mail.DefaultFromAddress", input.Email.DefaultFromAddress);

            await this.SettingManager.ChangeSettingForApplicationAsync("Abp.Net.Mail.DefaultFromDisplayName", input.Email.DefaultFromDisplayName);

            await this.SettingManager.ChangeSettingForApplicationAsync("Abp.Net.Mail.Smtp.Host", input.Email.SmtpHost);

            ISettingManager settingManager1 = this.SettingManager;
            int             smtpPort        = input.Email.SmtpPort;
            await settingManager1.ChangeSettingForApplicationAsync("Abp.Net.Mail.Smtp.Port", smtpPort.ToString(CultureInfo.InvariantCulture));

            await this.SettingManager.ChangeSettingForApplicationAsync("Abp.Net.Mail.Smtp.UserName", input.Email.SmtpUserName);

            await this.SettingManager.ChangeSettingForApplicationAsync("Abp.Net.Mail.Smtp.Password", input.Email.SmtpPassword);

            await this.SettingManager.ChangeSettingForApplicationAsync("Abp.Net.Mail.Smtp.Domain", input.Email.SmtpDomain);

            ISettingManager settingManager2 = this.SettingManager;

            isEmailConfirmationRequiredForLogin = input.Email.SmtpEnableSsl;
            await settingManager2.ChangeSettingForApplicationAsync("Abp.Net.Mail.Smtp.EnableSsl", isEmailConfirmationRequiredForLogin.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            ISettingManager settingManager3 = this.SettingManager;

            isEmailConfirmationRequiredForLogin = input.Email.SmtpUseDefaultCredentials;
            await settingManager3.ChangeSettingForApplicationAsync("Abp.Net.Mail.Smtp.UseDefaultCredentials", isEmailConfirmationRequiredForLogin.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));
        }
示例#2
0
        public async Task UpdateAllSettings(HostSettingsEditDto input)
        {
            //General
            await SettingManager.ChangeSettingForApplicationAsync(AppSettings.General.WebSiteRootAddress, input.General.WebSiteRootAddress.EnsureEndsWith('/'));

            //User management
            await SettingManager.ChangeSettingForApplicationAsync(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin, input.UserManagement.IsEmailConfirmationRequiredForLogin.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            //Email
            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.DefaultFromAddress, input.Email.DefaultFromAddress);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.DefaultFromDisplayName, input.Email.DefaultFromDisplayName);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Host, input.Email.SmtpHost);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Port, input.Email.SmtpPort.ToString(CultureInfo.InvariantCulture));

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.UserName, input.Email.SmtpUserName);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Password, input.Email.SmtpPassword);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Domain, input.Email.SmtpDomain);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.EnableSsl, input.Email.SmtpEnableSsl.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.UseDefaultCredentials, input.Email.SmtpUseDefaultCredentials.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));
        }
示例#3
0
 public async Task UpdateAllSettings(HostSettingsEditDto input)
 {
     await UpdateGeneralSettingsAsync(input.General);
     await UpdateTenantManagementAsync(input.TenantManagement);
     await UpdateUserManagementSettingsAsync(input.UserManagement);
     await UpdateSecuritySettingsAsync(input.Security);
     await UpdateEmailSettingsAsync(input.Email);
 }
示例#4
0
        public async Task <HostSettingsEditDto> GetAllSettings()
        {
            var timezone = await SettingManager.GetSettingValueForApplicationAsync(TimingSettingNames.TimeZone);

            var hostSettings = new HostSettingsEditDto
            {
                General = new GeneralSettingsEditDto
                {
                    WebSiteRootAddress    = await SettingManager.GetSettingValueAsync(AppSettings.General.WebSiteRootAddress),
                    Timezone              = timezone,
                    TimezoneForComparison = timezone,
                    AuditSaveToDB         = await SettingManager.GetSettingValueAsync <bool>(AppSettings.General.AuditSaveToDB),
                    //Get RedisCache
                    UseRedisCacheByDefault = await SettingManager.GetSettingValueAsync <bool>(AppSettings.General.UseRedisCacheByDefault)
                },
                TenantManagement = new TenantManagementSettingsEditDto
                {
                    AllowSelfRegistration = await SettingManager.GetSettingValueAsync <bool>(AppSettings.TenantManagement.AllowSelfRegistration),
                    IsNewRegisteredTenantActiveByDefault = await SettingManager.GetSettingValueAsync <bool>(AppSettings.TenantManagement.IsNewRegisteredTenantActiveByDefault),
                    UseCaptchaOnRegistration             = await SettingManager.GetSettingValueAsync <bool>(AppSettings.TenantManagement.UseCaptchaOnRegistration)
                },
                UserManagement = new HostUserManagementSettingsEditDto
                {
                    IsEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin)
                },
                Email = new EmailSettingsEditDto
                {
                    DefaultFromAddress     = await SettingManager.GetSettingValueAsync(EmailSettingNames.DefaultFromAddress),
                    DefaultFromDisplayName = await SettingManager.GetSettingValueAsync(EmailSettingNames.DefaultFromDisplayName),
                    SmtpHost                  = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Host),
                    SmtpPort                  = await SettingManager.GetSettingValueAsync <int>(EmailSettingNames.Smtp.Port),
                    SmtpUserName              = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.UserName),
                    SmtpPassword              = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Password),
                    SmtpDomain                = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Domain),
                    SmtpEnableSsl             = await SettingManager.GetSettingValueAsync <bool>(EmailSettingNames.Smtp.EnableSsl),
                    SmtpUseDefaultCredentials = await SettingManager.GetSettingValueAsync <bool>(EmailSettingNames.Smtp.UseDefaultCredentials)
                }
            };

            var defaultTenantId = await SettingManager.GetSettingValueAsync(AppSettings.TenantManagement.DefaultEdition);

            if (!string.IsNullOrEmpty(defaultTenantId) && (await _editionManager.FindByIdAsync(Convert.ToInt32(defaultTenantId)) != null))
            {
                hostSettings.TenantManagement.DefaultEditionId = Convert.ToInt32(defaultTenantId);
            }

            var defaultTimeZoneId = await _timeZoneService.GetDefaultTimezoneAsync(SettingScopes.Application, AbpSession.TenantId);

            if (hostSettings.General.Timezone == defaultTimeZoneId)
            {
                hostSettings.General.Timezone = string.Empty;
            }

            return(hostSettings);
        }
 public async Task UpdateAllSettings(HostSettingsEditDto input)
 {
     await UpdateGeneralSettingsAsync(input.General);
     await UpdateTenantManagementAsync(input.TenantManagement);
     await UpdateUserManagementSettingsAsync(input.UserManagement);
     await UpdateSecuritySettingsAsync(input.Security);
     await UpdateEmailSettingsAsync(input.Email);
     await UpdateBillingSettingsAsync(input.Billing);
     await UpdateOtherSettingsAsync(input.OtherSettings);
     await UpdateExternalLoginSettingsAsync(input.ExternalLoginProviderSettings);
 }
        public async Task <HostSettingsEditDto> GetAllSettings()
        {
            HostSettingsEditDto    hostSettingsEditDto    = new HostSettingsEditDto();
            HostSettingsEditDto    hostSettingsEditDto1   = hostSettingsEditDto;
            GeneralSettingsEditDto generalSettingsEditDto = new GeneralSettingsEditDto()
            {
                WebSiteRootAddress = await this.SettingManager.GetSettingValueAsync("App.General.WebSiteRootAddress")
            };

            hostSettingsEditDto1.General = generalSettingsEditDto;
            HostSettingsEditDto hostSettingsEditDto2 = hostSettingsEditDto;
            HostUserManagementSettingsEditDto hostUserManagementSettingsEditDto  = new HostUserManagementSettingsEditDto();
            HostUserManagementSettingsEditDto hostUserManagementSettingsEditDto1 = hostUserManagementSettingsEditDto;
            bool settingValueAsync = await this.SettingManager.GetSettingValueAsync <bool>("Abp.Zero.UserManagement.IsEmailConfirmationRequiredForLogin");

            hostUserManagementSettingsEditDto1.IsEmailConfirmationRequiredForLogin = settingValueAsync;
            hostSettingsEditDto2.UserManagement = hostUserManagementSettingsEditDto;
            HostSettingsEditDto  hostSettingsEditDto3 = hostSettingsEditDto;
            EmailSettingsEditDto emailSettingsEditDto = new EmailSettingsEditDto()
            {
                DefaultFromAddress     = await this.SettingManager.GetSettingValueAsync("Abp.Net.Mail.DefaultFromAddress"),
                DefaultFromDisplayName = await this.SettingManager.GetSettingValueAsync("Abp.Net.Mail.DefaultFromDisplayName"),
                SmtpHost = await this.SettingManager.GetSettingValueAsync("Abp.Net.Mail.Smtp.Host")
            };
            EmailSettingsEditDto emailSettingsEditDto1 = emailSettingsEditDto;
            int num = await this.SettingManager.GetSettingValueAsync <int>("Abp.Net.Mail.Smtp.Port");

            emailSettingsEditDto1.SmtpPort    = num;
            emailSettingsEditDto.SmtpUserName = await this.SettingManager.GetSettingValueAsync("Abp.Net.Mail.Smtp.UserName");

            emailSettingsEditDto.SmtpPassword = await this.SettingManager.GetSettingValueAsync("Abp.Net.Mail.Smtp.Password");

            emailSettingsEditDto.SmtpDomain = await this.SettingManager.GetSettingValueAsync("Abp.Net.Mail.Smtp.Domain");

            EmailSettingsEditDto emailSettingsEditDto2 = emailSettingsEditDto;
            bool flag = await this.SettingManager.GetSettingValueAsync <bool>("Abp.Net.Mail.Smtp.EnableSsl");

            emailSettingsEditDto2.SmtpEnableSsl = flag;
            EmailSettingsEditDto emailSettingsEditDto3 = emailSettingsEditDto;
            bool settingValueAsync1 = await this.SettingManager.GetSettingValueAsync <bool>("Abp.Net.Mail.Smtp.UseDefaultCredentials");

            emailSettingsEditDto3.SmtpUseDefaultCredentials = settingValueAsync1;
            hostSettingsEditDto3.Email = emailSettingsEditDto;
            return(hostSettingsEditDto);
        }
示例#7
0
        public async Task <HostSettingsEditDto> GetAllSettings()
        {
            var timezone = await SettingManager.GetSettingValueForApplicationAsync(TimingSettingNames.TimeZone);

            var hostSettings = new HostSettingsEditDto
            {
                General = new GeneralSettingsEditDto
                {
                    WebSiteRootAddress    = await SettingManager.GetSettingValueAsync(AppSettings.General.WebSiteRootAddress),
                    WebSiteStatus         = await SettingManager.GetSettingValueAsync <bool>(AppSettings.General.WebSiteStatus),
                    AppName               = await SettingManager.GetSettingValueAsync(AppSettings.General.AppName),
                    AppLogo               = await SettingManager.GetSettingValueAsync(AppSettings.General.AppLogo),
                    AppTitleLogo          = await SettingManager.GetSettingValueAsync(AppSettings.General.AppTitleLogo),
                    Timezone              = timezone,
                    TimezoneForComparison = timezone
                },
                UserManagement = new HostUserManagementSettingsEditDto
                {
                    IsEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(CommonFrameSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin)
                },
                Email = new EmailSettingsEditDto
                {
                    DefaultFromAddress     = await SettingManager.GetSettingValueAsync(EmailSettingNames.DefaultFromAddress),
                    DefaultFromDisplayName = await SettingManager.GetSettingValueAsync(EmailSettingNames.DefaultFromDisplayName),
                    SmtpHost                  = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Host),
                    SmtpPort                  = await SettingManager.GetSettingValueAsync <int>(EmailSettingNames.Smtp.Port),
                    SmtpUserName              = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.UserName),
                    SmtpPassword              = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Password),
                    SmtpDomain                = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Domain),
                    SmtpEnableSsl             = await SettingManager.GetSettingValueAsync <bool>(EmailSettingNames.Smtp.EnableSsl),
                    SmtpUseDefaultCredentials = await SettingManager.GetSettingValueAsync <bool>(EmailSettingNames.Smtp.UseDefaultCredentials)
                }
            };
            var defaultTenantId = await SettingManager.GetSettingValueAsync(AppSettings.TenantManagement.DefaultEdition);

            var passwordComplexitySetting = await SettingManager.GetSettingValueAsync(AppSettings.Security.PasswordComplexity);

            var defaultPasswordComplexitySetting = _settingDefinitionManager.GetSettingDefinition(AppSettings.Security.PasswordComplexity).DefaultValue;

            return(hostSettings);
        }
        public async Task <HostSettingsEditDto> GetAllSettings()
        {
            var hostSettings = new HostSettingsEditDto
            {
                General = new GeneralSettingsEditDto
                {
                    WebSiteRootAddress = await SettingManager.GetSettingValueAsync(AppSettings.General.WebSiteRootAddress)
                },
                TenantManagement = new TenantManagementSettingsEditDto
                {
                    AllowSelfRegistration = await SettingManager.GetSettingValueAsync <bool>(AppSettings.TenantManagement.AllowSelfRegistration),
                    IsNewRegisteredTenantActiveByDefault = await SettingManager.GetSettingValueAsync <bool>(AppSettings.TenantManagement.IsNewRegisteredTenantActiveByDefault),
                    UseCaptchaOnRegistration             = await SettingManager.GetSettingValueAsync <bool>(AppSettings.TenantManagement.UseCaptchaOnRegistration)
                },
                UserManagement = new HostUserManagementSettingsEditDto
                {
                    IsEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync <bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin)
                },
                Email = new EmailSettingsEditDto
                {
                    DefaultFromAddress     = await SettingManager.GetSettingValueAsync(EmailSettingNames.DefaultFromAddress),
                    DefaultFromDisplayName = await SettingManager.GetSettingValueAsync(EmailSettingNames.DefaultFromDisplayName),
                    SmtpHost                  = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Host),
                    SmtpPort                  = await SettingManager.GetSettingValueAsync <int>(EmailSettingNames.Smtp.Port),
                    SmtpUserName              = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.UserName),
                    SmtpPassword              = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Password),
                    SmtpDomain                = await SettingManager.GetSettingValueAsync(EmailSettingNames.Smtp.Domain),
                    SmtpEnableSsl             = await SettingManager.GetSettingValueAsync <bool>(EmailSettingNames.Smtp.EnableSsl),
                    SmtpUseDefaultCredentials = await SettingManager.GetSettingValueAsync <bool>(EmailSettingNames.Smtp.UseDefaultCredentials)
                }
            };

            var defaultTenantId = await SettingManager.GetSettingValueAsync(AppSettings.TenantManagement.DefaultEdition);

            if (!string.IsNullOrEmpty(defaultTenantId) && (await _editionManager.FindByIdAsync(Convert.ToInt32(defaultTenantId)) != null))
            {
                hostSettings.TenantManagement.DefaultEditionId = Convert.ToInt32(defaultTenantId);
            }

            return(hostSettings);
        }
示例#9
0
        public async Task UpdateAllSettings(HostSettingsEditDto input)
        {
            //General
            await SettingManager.ChangeSettingForApplicationAsync(AppSettings.General.WebSiteRootAddress, input.General.WebSiteRootAddress.EnsureEndsWith('/'));

            if (Clock.SupportsMultipleTimezone)
            {
                if (input.General.Timezone.IsNullOrEmpty())
                {
                    var defaultValue = await _timeZoneService.GetDefaultTimezoneAsync(SettingScopes.Application, AbpSession.TenantId);

                    await SettingManager.ChangeSettingForApplicationAsync(TimingSettingNames.TimeZone, defaultValue);
                }
                else
                {
                    await SettingManager.ChangeSettingForApplicationAsync(TimingSettingNames.TimeZone, input.General.Timezone);
                }
            }

            //Tenant management
            await SettingManager.ChangeSettingForApplicationAsync(AppSettings.TenantManagement.AllowSelfRegistration, input.TenantManagement.AllowSelfRegistration.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            await SettingManager.ChangeSettingForApplicationAsync(AppSettings.TenantManagement.IsNewRegisteredTenantActiveByDefault, input.TenantManagement.IsNewRegisteredTenantActiveByDefault.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            await SettingManager.ChangeSettingForApplicationAsync(AppSettings.TenantManagement.UseCaptchaOnRegistration, input.TenantManagement.UseCaptchaOnRegistration.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            var defaultEditionId = (input.TenantManagement.DefaultEditionId == null ? null : input.TenantManagement.DefaultEditionId.Value.ToString()) ?? "";

            await SettingManager.ChangeSettingForApplicationAsync(AppSettings.TenantManagement.DefaultEdition, defaultEditionId);

            //User management
            await SettingManager.ChangeSettingForApplicationAsync(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin, input.UserManagement.IsEmailConfirmationRequiredForLogin.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            //Security
            if (input.Security.UseDefaultPasswordComplexitySettings)
            {
                await SettingManager.ChangeSettingForApplicationAsync(AppSettings.Security.PasswordComplexity, input.Security.DefaultPasswordComplexity.ToJsonString());
            }
            else
            {
                await SettingManager.ChangeSettingForApplicationAsync(AppSettings.Security.PasswordComplexity, input.Security.PasswordComplexity.ToJsonString());
            }

            //Email
            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.DefaultFromAddress, input.Email.DefaultFromAddress);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.DefaultFromDisplayName, input.Email.DefaultFromDisplayName);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Host, input.Email.SmtpHost);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Port, input.Email.SmtpPort.ToString(CultureInfo.InvariantCulture));

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.UserName, input.Email.SmtpUserName);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Password, input.Email.SmtpPassword);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.Domain, input.Email.SmtpDomain);

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.EnableSsl, input.Email.SmtpEnableSsl.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));

            await SettingManager.ChangeSettingForApplicationAsync(EmailSettingNames.Smtp.UseDefaultCredentials, input.Email.SmtpUseDefaultCredentials.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture));
        }