Exemplo n.º 1
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;
        }
Exemplo n.º 2
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;
        }