Ejemplo n.º 1
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            string   email           = TbEmail.Text;
            string   password        = PbPassword.Password;
            Customer fetchedCustomer = dbHandler.GetCustomer(email);

            if (fetchedCustomer != null)
            {
                if (BCrypt.Net.BCrypt.Verify(password, fetchedCustomer.Password))
                {
                    Constants.loggedInCustomer = fetchedCustomer;
                    dbHandler.ResetFailedLoginAttempts(fetchedCustomer);
                    MainWindow main = new MainWindow();
                    main.Show();
                    authWindow.Hide();
                }
                else
                {
                    dbHandler.UpdateFailedLoginAttempts(fetchedCustomer);
                    MessageBox.Show("Wrong information entered, try again!");

                    if (fetchedCustomer.FailedLoginAttempts > 2)
                    {
                        MessageBox.Show("Du har brugt 3 forkerte forsøg, prøv igen senere!");
                    }
                }
            }
            else
            {
                //Wrong username!
                MessageBox.Show("Wrong information entered, try again!");
            }
        }
Ejemplo n.º 2
0
        private void AuthenticationViewModel_SignUpConfirmed()
        {
            _authenticationWindow.Hide();
            var registrationViewModel = new RegistrationViewModel();

            registrationViewModel.RegisterConfirmed += RegistrationViewModel_RegisterConfirmed;
            _registrationWindow         = new RegistrationWindow(registrationViewModel);
            _registrationWindow.Closed += RegistrationWindow_Closed;
            _registrationWindow.ShowDialog();
        }