Esempio n. 1
0
        private void LoginBtn_Click(object sender, RoutedEventArgs e)
        {
            string user = LoginBox.Text;
            string pswd = PasswordBox.Password;

            if (MyAes.EncryptStringToString(pswd).Length <= 255)
            {
                userDto = AppUserOperations.SelectAppUser(user, pswd);
            }

            if (userDto != null)
            {
                AuthBox.Visibility    = Visibility.Visible;
                AuthBtn.Visibility    = Visibility.Visible;
                AuthBox.IsEnabled     = true;
                AuthBtn.IsEnabled     = true;
                LoginBtn.IsEnabled    = false;
                RegisterBtn.IsEnabled = false;

                timer.Start();
                stopwatch.Start();
                try
                {
                    Task.Run(() => { SendAuthCode(user); });
                }
                catch (SmtpException exc)
                {
                    Debug.WriteLine(exc);
                }
            }
            else
            {
                MessageBox.Show("Nieprawidłowe dane logowania.");
            }
        }
Esempio n. 2
0
        private void RegisterBtn_Click(object sender, RoutedEventArgs e)
        {
            string user = LoginBox.Text;
            string pswd = PasswordBox.Password;

            if (MyAes.EncryptStringToString(pswd).Length <= 255)
            {
                bool succeeded = AppUserOperations.AddAppUser(user, pswd);

                if (succeeded)
                {
                    MessageBox.Show("Założono nowe konto.");
                }
                else
                {
                    MessageBox.Show("Zakładanie konta nie powiodło się.");
                }
            }
            else
            {
                MessageBox.Show("Zakładanie konta nie powiodło się.");
            }
        }