예제 #1
0
        void Settings_OnCheckingSettings(SprocketSettings.SettingsErrors errors)
        {
            if (!IntegrationEnabled)
            {
                return;
            }

            if (TestMode)
            {
                if (SprocketSettings.GetValue("PayPalTestIdentityToken") == null)
                {
                    errors.Add("PayPal", "PayPalTestMode setting has been specified, thus a value is required for PayPalTestIdentityToken. This is the PayPal-supplied identity token for use with the PayPal Sandbox development environment. See developer.paypal.com for more info.");
                    errors.SetCriticalError();
                }
                if (SprocketSettings.GetValue("PayPalTestAccountAddress") == null)
                {
                    errors.Add("PayPal", "PayPalTestMode setting has been specified, thus a value is required for PayPalTestAccountAddress. This is a test PayPal account address for use with the PayPal Sandbox development environment. See developer.paypal.com for more info.");
                    errors.SetCriticalError();
                }
            }
            else
            {
                if (SprocketSettings.GetValue("PayPalIdentityToken") == null)
                {
                    errors.Add("PayPal", "The PayPalTestMode setting is disabled and the PayPalIntegration setting is enabled, thus a value is required for PayPalIdentityToken. This is the PayPal-supplied identity token for authenticating PayPal responses. See developer.paypal.com for more info.");
                    errors.SetCriticalError();
                }
                if (SprocketSettings.GetValue("PayPalAccountAddress") == null)
                {
                    errors.Add("PayPal", "The PayPalTestMode setting is disabled and the PayPalIntegration setting is enabled, thus a value is required for PayPalAccountAddress. This is the PayPal account address that is to receive transaction payments. See developer.paypal.com for more info.");
                    errors.SetCriticalError();
                }
            }
        }
예제 #2
0
        void OnCheckSettings(SprocketSettings.SettingsErrors errors)
        {
            if (SprocketSettings.GetValue("ConnectionString") == null)
            {
                errors.Add("DatabaseManager", "The application settings (.config) file requires a valid value for \"ConnectionString\".");
                errors.SetCriticalError();
            }
            if (SprocketSettings.GetValue("DatabaseEngine") == null)
            {
                errors.Add("DatabaseManager", "The application settings (.config) file requires a valid value for \"DatabaseEngine\".");
                errors.SetCriticalError();
            }
            if (errors.HasCriticalError)
            {
                return;
            }

            DatabaseEngine engType;

            try { engType = Database.ParseEngineName(SprocketSettings.GetValue("DatabaseEngine")); }
            catch (SprocketException)
            {
                errors.Add("DatabaseManager", "The value for \"DatabaseEngine\" is not valid.");
                errors.SetCriticalError();
                return;
            }

            Database db = Database.Create(engType);

            db.ConnectionString = SprocketSettings.GetValue("ConnectionString");
            string errorMessage;

            if (!db.TestConnectionString(out errorMessage))
            {
                string msg = errorMessage;
                //if (msg.ToLower().Contains("password")
                //    || msg.ToLower().Contains("pwd")
                //    || msg.ToLower().Contains("pass")
                //    || msg.ToLower().Contains("pword"))
                //    msg = "[error message hidden because it contains password information]";
                errors.Add("DatabaseManager", "The supplied connection string didn't work. The error was: " + msg);
                errors.SetCriticalError();
                return;
            }

            defaultConnectionString = db.ConnectionString;
            defaultEngine           = db.DatabaseEngine;
        }
예제 #3
0
        void OnCheckingSettings(SprocketSettings.SettingsErrors errors)
        {
            string path = HttpContext.Current.Request.PhysicalApplicationPath + @"\ClientID.config";

            if (File.Exists(path))
            {
                StreamReader sr   = new StreamReader(path);
                string       guid = sr.ReadToEnd().Trim();
                try { clientID = new Guid(guid); }
                catch
                {
                    errors.Add("WebSecurity", "The existing ClientID.config file contains an invalid unique identifier. If the file has been corrupted, someone with direct database access can retrieve the ClientID from Clients table.");
                    errors.SetCriticalError();
                    return;
                }
            }
            else
            {
                StreamWriter sw = new StreamWriter(path);
                clientID = Guid.NewGuid();
                sw.Write(clientID.ToString());
                sw.Flush();
                sw.Close();
            }
        }
예제 #4
0
        void OnCheckingSprocketSettings(SprocketSettings.SettingsErrors errors)
        {
            string psl = SprocketSettings.GetValue("PreventSimultaneousLogins");

            if (psl == null)
            {
                errors.Add(this, "The Web.config file is missing a value for \"PreventSimultaneousLogins\". The value should be \"True\" or \"False\".");
                errors.SetCriticalError();
                return;
            }
            if (psl.ToLower() != "true" && psl.ToLower() != "false")
            {
                errors.Add(this, "The Web.config file value for \"PreventSimultaneousLogins\" is invalid. The value should be \"True\" or \"False\".");
                errors.SetCriticalError();
                return;
            }
        }