示例#1
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            //Authenticate user
            User user = UserBase.FindUser(usernameTextbox.Text, passwordTextbox.Text);

            if (user != null)
            {
                //decrypt studd using this base
                MessageBox.Show($"Welcome {user.username}");
            }
        }
示例#2
0
        private void Register_Click(object sender, RoutedEventArgs e)
        {
            User user = UserBase.FindUser(usernameTextbox.Text, passwordTextbox.Text);

            if (user == null)
            {
                //decrypt studd using this base
                if (passwordTextbox.Text != confirmPasswordTextbox.Text)
                {
                    MessageBox.Show("Passwords do not match");
                }
                else
                {
                    User newUser = new User(usernameTextbox.Text, passwordTextbox.Text);
                    UserBase.AddUser(newUser);

                    MessageBox.Show($"Account for {newUser.username} has succesfully been created");
                }
            }
            else
            {
                MessageBox.Show("This user can not be created. Maybe try using a different username");
            }
        }