예제 #1
0
        private void LogIn_button_Click(object sender, RoutedEventArgs e)
        {
            currentUsername = Username_textbox.Text;


            byte[] data = System.Text.Encoding.ASCII.GetBytes(Password_textbox.Password);
            data = new System.Security.Cryptography.SHA256Managed().ComputeHash(data);
            String hashPassword = System.Text.Encoding.ASCII.GetString(data);

            var context = new MyFitEntities();

            var check = (from c in context.AccountCredentials where c.AccUsername == Username_textbox.Text select c).FirstOrDefault();

            if (check == null)
            {
                MessageBox.Show("You don't have an account!");
                NewAccountWindow1 window = new NewAccountWindow1();
                window.Show();
            }
            else if (check.AccUsername == Username_textbox.Text && check.AccPassword == hashPassword)
            {
                currentUsername = Username_textbox.Text;
                HomePageWindow home = new HomePageWindow();
                home.Show();
                this.Close();
            }
            else if (check.AccPassword != hashPassword)
            {
                MessageBox.Show("Wrong password!");
            }
        }
예제 #2
0
        private void newAccount_label_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            NewAccountWindow1 window = new NewAccountWindow1();

            window.Show();
        }