Beispiel #1
0
 private void ButtonLogin_Click(object sender, RoutedEventArgs e)
 {
     if (_repo.Authorize(TextBox_Login.Text, PasswordBox_Password.Password))
     {
         ChooseVariant chooseVariant = new ChooseVariant();
         chooseVariant.Show();
         Hide();
     }
     else
     {
         MessageBox.Show("Invalid login or password");
     }
 }
Beispiel #2
0
        private void ButtonRegister_Click(object sender, RoutedEventArgs e)
        {
            var user = new User
            {
                Login    = TextBox_Login.Text,
                Password = PasswordHelper.GetHash(PasswordBox_Password.Password)
            };
            string errMessage = "";

            if (_repo.RegisterUser(user, ref errMessage))
            {
                ChooseVariant chooseVariant = new ChooseVariant();
                chooseVariant.Show();
                Hide();
            }
            else
            {
                MessageBox.Show(errMessage);
            }
        }
Beispiel #3
0
        private void ButtonRegister_Click(object sender, RoutedEventArgs e)
        {
            var user = new User
            {
                Login    = TextBox_Login.Text,
                Password = PasswordHelper.GetHash(PasswordBox_Password.Password)
            };

            try
            {
                _repo.RegisterUser(user);
                ChooseVariant chooseVariant = new ChooseVariant();
                chooseVariant.Show();
                Hide();
            }
            catch
            {
                MessageBox.Show("An error occured trying to save new user");
            }
        }