Example #1
0
        public static void Log(IMemberShipData msd, IBucketListData bld, string method, IList<string> parameters)
        {
            if (msd != null)
            {
                string msg = method + " - ";

                foreach (string parameter in parameters)
                    msg += parameter + ", ";

                msg = msg.Trim(' ');
                msg = msg.Trim(',');

                msd.LogMsg(msg);
            }
            else if (bld != null)
            {
                string msg = method + " - ";

                foreach (string parameter in parameters)
                    msg += parameter + ", ";

                msg = msg.Trim(' ');
                msg = msg.Trim(',');

                bld.LogMsg(msg);
            }
        }
Example #2
0
        public static void Log(IMemberShipData msd, IBucketListData bld, string method, IList <string> parameters)
        {
            if (msd != null)
            {
                string msg = method + " - ";

                foreach (string parameter in parameters)
                {
                    msg += parameter + ", ";
                }

                msg = msg.Trim(' ');
                msg = msg.Trim(',');

                msd.LogMsg(msg);
            }
            else if (bld != null)
            {
                string msg = method + " - ";

                foreach (string parameter in parameters)
                {
                    msg += parameter + ", ";
                }

                msg = msg.Trim(' ');
                msg = msg.Trim(',');

                bld.LogMsg(msg);
            }
        }
Example #3
0
        public bool ProcessUserRegistration(string encodedUser, string encodedEmail, string encodedPass)
        {
            IMemberShipData msd       = null;
            bool            userAdded = false;

            try
            {
                msd = new Data(Utilities.GetDbSetting());
                string decodedUser  = Utilities.DecodeClientBase64String(encodedUser);
                string decodedEmail = Utilities.DecodeClientBase64String(encodedEmail);
                string decodedPass  = Utilities.DecodeClientBase64String(encodedPass);

                //LogParameters();
                if (Utilities.ValidUserToRegistration(decodedUser, decodedEmail, decodedPass))
                {
                    Password    p  = new Password();
                    NewPassword np = p.GetPassword(decodedPass);
                    userAdded = msd.AddUser(decodedUser, decodedEmail, np.SaltedHashedPassword, np.Salt);
                }
            }
            catch (Exception e)
            {
                msd.LogMsg("Error: " + e.Message + ", trace: " + e.StackTrace.ToString());
            }

            return(userAdded);
        }
Example #4
0
        public string ProcessUser(string encodedUser, string encodedPass)
        {
            IMemberShipData msd   = null;
            string          token = string.Empty;

            try
            {
                msd = new Data(Utilities.GetDbSetting());
                string decodedUser = Utilities.DecodeClientBase64String(encodedUser);
                string decodedPass = Utilities.DecodeClientBase64String(encodedPass);

                //LogParameters();

                token = VerifyUser(decodedUser, decodedPass, msd);
                if (!string.IsNullOrEmpty(token))
                {
                    msd.AddToken(decodedUser, token);
                }
            }
            catch (Exception e)
            {
                msd.LogMsg("Error: " + e.Message + ", trace: " + e.StackTrace.ToString());
            }

            return(token);
        }
Example #5
0
        private void LogProcessUserParameters(string userName, IMemberShipData msd)
        {
            IList <string> parameters = new List <string>();

            parameters.Add(userName);
            CommonCode.Log(msd, null, "ProcessUser", parameters);
        }
Example #6
0
        private string VerifyUser(string userName, string password, IMemberShipData msd)
        {
            string token = string.Empty;
            User   u     = msd.GetUser(userName);

            if (u != null)
            {
                Password p = new Password();

                bool goodUser = p.UserExists(u, password);

                if (goodUser)
                {
                    token = Utilities.GenerateToken();
                }
            }

            return(token);
        }
Example #7
0
        public string LoginDemoUser()
        {
            string          token = string.Empty;
            IMemberShipData msd   = null;

            try
            {
                msd   = new Data(Utilities.GetDbSetting());
                token = VerifyUser(AccountDataProvider.Constants.DEMO_USER, AccountDataProvider.Constants.DEMO_USER_PASSWORD, msd);

                if (!string.IsNullOrEmpty(token))
                {
                    msd.AddToken(AccountDataProvider.Constants.DEMO_USER, token);
                }
            }
            catch (Exception e)
            {
                msd.LogMsg("Error: " + e.Message + ", trace: " + e.StackTrace.ToString());
            }

            return(token);
        }
Example #8
0
        private string VerifyUser(string userName, string password, IMemberShipData msd)
        {
            string token = string.Empty;
            User u = msd.GetUser(userName);

            if (u != null)
            {
                Password p = new Password();

                bool goodUser = p.UserExists(u, password);

                if (goodUser)
                    token = Utilities.GenerateToken();
            }

            return token;
        }
Example #9
0
 private void LogProcessUserParameters(string userName, IMemberShipData msd)
 {
     IList<string> parameters = new List<string>();
     parameters.Add(userName);
     CommonCode.Log(msd, null, "ProcessUser", parameters);
 }