Esempio n. 1
0
        void testOne()
        {
            string userName = txtBoxUserName.Text.ToString();
            string password = txtBoxPassword.Password;
            Thread t1       = new Thread(testThis);

            t1.IsBackground = true;
            t1.Start();
            //MessageBox.Show("s");
            bool userFound = false;

            //bool test = VerifyHashedPassword(hashedPassword, password);
            //MessageBox.Show(hashedPassword);
            //t1.Join();
            t1.Join();
            foreach (AspNetUsers au in user1)
            {
                string hashedPassword = HashPassword(password);
                bool   test11         = VerifyHashedPassword(au.PasswordHash, password);
                if (test11 && au.UserName == userName)
                {
                    userFound = true;
                    var mainProgram = new BookIT(au);
                    mainProgram.Show();
                    this.Close();
                    break;
                }
            }
        }
Esempio n. 2
0
        void bgWorker_userDataLoadComplete(object sender, RunWorkerCompletedEventArgs e)
        {
            string userName  = txtBoxUserName.Text.ToString();
            string password  = txtBoxPassword.Password;
            bool   userFound = false;

            foreach (AspNetUsers au in user1)
            {
                string hashedPassword = "";
                if (credentialsLoaded)
                {
                    hashedPassword = HashPassword(password);
                }
                else
                {
                    hashedPassword = password;
                }
                bool test11 = VerifyHashedPassword(au.PasswordHash, password);
                if (test11 && au.UserName == userName)
                {
                    if (checkBoxRemember.IsChecked == true && credentialsLoaded == false)
                    {
                        saveCredentials(userName, hashedPassword);
                    }
                    // userFound = true;
                    //MessageBox.Show(au.UserName);
                    //MessageBox.Show(au.PasswordHash);
                    var mainProgram = new BookIT(au);
                    mainProgram.Show();
                    userFound = true;
                    this.Close();
                    break;
                }
            }
            if (!userFound)
            {
                credentialsLoaded = false;
                MessageBox.Show("Data not found");
            }
        }