public HttpResponseMessage GetSmtpSettings()
        {
            try
            {
                var portalId = PortalSettings.Current.PortalId;

                var smtpSettings = new
                {
                    smtpServerMode = PortalController.GetPortalSetting("SMTPmode", portalId, "h"),
                    host           = new{},
                    site           = new
                    {
                        smtpServer          = PortalController.GetPortalSetting("SMTPServer", portalId, string.Empty),
                        smtpConnectionLimit = PortalController.GetPortalSettingAsInteger("SMTPConnectionLimit", portalId, 1),
                        smtpMaxIdleTime     = PortalController.GetPortalSettingAsInteger("SMTPMaxIdleTime", portalId, 0),
                        smtpAuthentication  = PortalController.GetPortalSetting("SMTPAuthentication", portalId, "0"),
                        enableSmtpSsl       = PortalController.GetPortalSetting("SMTPEnableSSL", portalId, string.Empty) == "Y",
                        smtpUserName        = PortalController.GetPortalSetting("SMTPUsername", portalId, string.Empty),
                        smtpPassword        = PortalController.GetEncryptedString("SMTPPassword", portalId, Config.GetDecryptionkey())
                    },
                    portalName = PortalSettings.Current.PortalName
                };
                return(Request.CreateResponse(HttpStatusCode.OK, smtpSettings));
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc));
            }
        }
Exemple #2
0
        public HttpResponseMessage GetSmtpSettings()
        {
            try
            {
                var portalId = PortalSettings.Current.PortalId;

                var smtpSettings = new
                {
                    smtpServerMode = PortalController.GetPortalSetting("SMTPmode", portalId, "h"),
                    host           = new { },
                    site           = new
                    {
                        smtpServer          = PortalController.GetPortalSetting("SMTPServer", portalId, string.Empty),
                        smtpConnectionLimit = PortalController.GetPortalSettingAsInteger("SMTPConnectionLimit", portalId, 2),
                        smtpMaxIdleTime     = PortalController.GetPortalSettingAsInteger("SMTPMaxIdleTime", portalId, 100000),
                        smtpAuthentication  = PortalController.GetPortalSetting("SMTPAuthentication", portalId, "0"),
                        enableSmtpSsl       = PortalController.GetPortalSetting("SMTPEnableSSL", portalId, string.Empty) == "Y",
                        smtpUserName        = PortalController.GetPortalSetting("SMTPUsername", portalId, string.Empty),
                        smtpPassword        = PortalController.GetEncryptedString("SMTPPassword", portalId, Config.GetDecryptionkey()),
                    },
                    portalName       = PortalSettings.Current.PortalName,
                    hideCoreSettings = ProviderConfiguration.GetProviderConfiguration("mail").GetDefaultProvider().Attributes.GetValueOrDefault("hideCoreSettings", false),
                };
                return(this.Request.CreateResponse(HttpStatusCode.OK, smtpSettings));
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc));
            }
        }
        internal static List <IUIData> GetData(int portalId, UserInfo userInfo)
        {
            Dictionary <string, IUIData> Settings = new Dictionary <string, IUIData>();
            string apikey    = PortalController.GetEncryptedString("Vanjaro.Integration.Pixabay", portalId, Config.GetDecryptionkey());
            bool   HasApiKey = false;

            if (!string.IsNullOrEmpty(apikey))
            {
                HasApiKey = true;
            }

            Settings.Add("ApiKey", new UIData {
                Name = "ApiKey", Value = apikey
            });
            Settings.Add("HasApiKey", new UIData {
                Name = "HasApiKey", Options = HasApiKey
            });
            return(Settings.Values.ToList());
        }
        internal static List <IUIData> GetData(int PortalId)
        {
            Dictionary <string, IUIData> Settings = new Dictionary <string, IUIData>
            {
                { "Server", new UIData {
                      Name = "Server", Value = PortalController.GetPortalSetting("SMTPServer", PortalId, string.Empty)
                  } },
                { "Username", new UIData {
                      Name = "Username", Value = PortalController.GetPortalSetting("SMTPUsername", PortalId, string.Empty)
                  } },
                { "Password", new UIData {
                      Name = "Password", Value = PortalController.GetEncryptedString("SMTPPassword", PortalId, Config.GetDecryptionkey())
                  } },
                { "EnableSSL", new UIData {
                      Name = "EnableSSL", Options = PortalController.GetPortalSetting("SMTPEnableSSL", PortalId, string.Empty) == "Y"
                  } }
            };

            return(Settings.Values.ToList());
        }
Exemple #5
0
        public HttpResponseMessage GetSmtpSettings()
        {
            try
            {
                var portalId = PortalSettings.Current.PortalId;

                var smtpSettings = new
                {
                    smtpServerMode = PortalController.GetPortalSetting("SMTPmode", portalId, "h"),
                    host           = new
                    {
                        smtpServer                = HostController.Instance.GetString("SMTPServer"),
                        smtpConnectionLimit       = HostController.Instance.GetInteger("SMTPConnectionLimit", 2),
                        smtpMaxIdleTime           = HostController.Instance.GetInteger("SMTPMaxIdleTime", 100000),
                        smtpAuthentication        = HostController.Instance.GetString("SMTPAuthentication"),
                        enableSmtpSsl             = HostController.Instance.GetBoolean("SMTPEnableSSL", false),
                        smtpUserName              = HostController.Instance.GetString("SMTPUsername"),
                        smtpPassword              = GetSmtpPassword(),
                        smtpHostEmail             = HostController.Instance.GetString("HostEmail"),
                        messageSchedulerBatchSize = Host.MessageSchedulerBatchSize
                    },
                    site = new
                    {
                        smtpServer          = PortalController.GetPortalSetting("SMTPServer", portalId, string.Empty),
                        smtpConnectionLimit = PortalController.GetPortalSettingAsInteger("SMTPConnectionLimit", portalId, 2),
                        smtpMaxIdleTime     = PortalController.GetPortalSettingAsInteger("SMTPMaxIdleTime", portalId, 100000),
                        smtpAuthentication  = PortalController.GetPortalSetting("SMTPAuthentication", portalId, "0"),
                        enableSmtpSsl       = PortalController.GetPortalSetting("SMTPEnableSSL", portalId, string.Empty) == "Y",
                        smtpUserName        = PortalController.GetPortalSetting("SMTPUsername", portalId, string.Empty),
                        smtpPassword        = PortalController.GetEncryptedString("SMTPPassword", portalId, Config.GetDecryptionkey())
                    },
                    portalName = PortalSettings.Current.PortalName
                };
                return(this.Request.CreateResponse(HttpStatusCode.OK, smtpSettings));
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc));
            }
        }