Beispiel #1
0
        private void SixButton_Click(object sender, EventArgs e)
        {
            if (!CheckPasswordLength())
            {
                return;
            }

            LoginTextBox.AppendText("6");
        }
Beispiel #2
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     if (LoginTextBox.Text.Equals(""))
     {
         return;
     }
     else
     {
         LoginTextBox.Clear();
     }
 }
Beispiel #3
0
        private void ValidateButton_Click(object sender, RoutedEventArgs e)
        {
            // Only adds if the label is unique and required fields are filled
            if (MyGlobals.Lista.Exists(x => x.DirectKey == LabelTextBox.Text))
            {
                Thread thread = new Thread(ShowRectangleLabelExists);
                thread.Start();

                LabelTextBox.Focus();
            }
            else
            {
                if (LoginTextBox.Text == String.Empty || LoginTextBox.Text == (String)LoginTextBox.Tag)
                {
                    Thread thread = new Thread(ShowRequiredFieldWarning);
                    thread.Start(ErrorFieldEmpty2);

                    LoginTextBox.Focus();
                }
                else
                {
                    if (LabelTextBox.Text == String.Empty || LabelTextBox.Text == (String)LabelTextBox.Tag)
                    {
                        Thread thread = new Thread(ShowRequiredFieldWarning);
                        thread.Start(ErrorFieldEmpty);

                        LabelTextBox.Focus();
                    }
                    else
                    {
                        if (PasswordTextBox.Text == String.Empty || PasswordTextBox.Text == (String)PasswordTextBox.Tag)
                        {
                            Thread thread = new Thread(ShowRequiredFieldWarning);
                            thread.Start(ErrorFieldEmpty3);

                            PasswordTextBox.Focus();
                        }
                        else
                        {
                            // Add entry to local list and database
                            AddEntry();

                            // Checks if temporary Item exists, if so clears it
                            if (MyGlobals.TemporaryItem.DirectKey != String.Empty)
                            {
                                MyGlobals.TemporaryItem = Items.Empty();
                            }

                            nav.Navigate(new System.Uri("InitialPage.xaml", UriKind.RelativeOrAbsolute));
                        }
                    }
                }
            }
        }
        public LoginWindow()
        {
            InitializeComponent();

            UserManager.PrepareDatabase();
            UserManager.EnsureAdminExists();

            LoginTextBox.Focus();

            Console.WriteLine("path " + appDataFolderPath);
        }
Beispiel #5
0
 private void LoginForm_Load(object sender, EventArgs e)
 {
     LoginTextBox.Invoke(new MethodInvoker(() =>
     {
         LoginTextBox.AutoCompleteMode   = AutoCompleteMode.Append;
         LoginTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
         var loginAutoCompleteSource     = new AutoCompleteStringCollection();
         loginAutoCompleteSource.AddRange(context.Users.Select(user => user.Login).ToArray());
         LoginTextBox.AutoCompleteCustomSource = loginAutoCompleteSource;
     }));
 }
 private void LoginTextBox_GotKeyboardFocus_1(object sender, KeyboardFocusChangedEventArgs e)
 {
     if (Properties.Settings.Default.Username_Login == "")
     {
         if (LoginTextBox != null && LoginTextBox.Text == "UserName")
         {
             LoginTextBox.Clear();
             LoginTextBox.FontStyle  = FontStyles.Normal;
             LoginTextBox.Foreground = Brushes.Black;
         }
     }
 }
 private void PasswordTextBox_KeyUp(object sender,
                                    KeyEventArgs e)
 {
     if (e.Key == Key.Enter || e.Key == Key.Down)
     {
         NicknameTextBox.Focus();
     }
     else if (e.Key == Key.Up)
     {
         LoginTextBox.Focus();
     }
 }
Beispiel #8
0
        public bool Auth(string login, bool isPhone)
        {
            LoginButton.Click();
            if (isPhone)
            {
                PhoneTab.Click();
            }
            LoginTextBox.SendKeys(login);
            PassTextBox.SendKeys(TestDataResource.Password);
            SubmitButton.Click();

            return(true);
        }
Beispiel #9
0
 public LoginForm(BusinessLayer business, bool debug)
 {
     _business = business;
     _debug    = debug;
     InitializeComponent();
     WarningLogin.Visible    = false;
     WarningPassword.Visible = false;
     LoginTextBox.Select();
     if (debug)
     {
         LoginTextBox.Text    = "admin";
         PasswordTextBox.Text = "admin";
     }
 }
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                LoginButton_Click(null, null);
            }

            else if (!LoginTextBox.IsFocused && e.Key == Key.Tab)
            {
                LoginTextBox.Focus();

                e.Handled = true;
            }
        }
        private void LoginPage_OnLoaded(object sender, RoutedEventArgs e)
        {
            WaitLogginStackPanel.Height = LoginStackPanel.ActualHeight + LoginStackPanel.Margin.Bottom +
                                          LoginStackPanel.Margin.Top;

            if (VM.IsApiTokenValid)
            {
                VM.SignInCommand.Execute(null);
            }
            else
            {
                LoginTextBox.Focus(FocusState.Programmatic);
            }
        }
Beispiel #12
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                Authorization();
            }

            else if (e.Key == Key.Tab && !LoginTextBox.IsFocused)
            {
                LoginTextBox.Focus();

                e.Handled = true;
            }
        }
Beispiel #13
0
        // Обрааботка авторризации
        private void AutorizationButton_Click(object sender, EventArgs e)
        {
            Checking checking = new Checking();

            if (!checking.Login(LoginTextBox.Text))
            {
                PromptLabel.Text = "Неправильный формат логина";
            }
            else if (!checking.Password(PasswordTextBox.Text))
            {
                PromptLabel.Text = "Неправильный формат пароля";
            }
            else if (!checking.LoginInBase(LoginTextBox.Text, PasswordTextBox.Text))
            {
                PromptLabel.Text = "Неправильный логин или пароль";
            }
            else
            {
                try
                {
                    // Обработка механизма запоминания логина
                    if (!RememberMe.Checked)
                    {
                        LoginTextBox.Clear();
                        string path = @"last_user.txt";
                        using (StreamWriter sr = new StreamWriter(path))
                        {
                            sr.WriteLine("");
                        }
                    }
                    else
                    {
                        string path = @"last_user.txt";
                        using (StreamWriter sr = new StreamWriter(path))
                        {
                            sr.WriteLine(LoginTextBox.Text);
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Простите, мы не сможем вас запомнить");
                }
                PasswordTextBox.Clear();
                MainForm nextForm = new MainForm(LoginTextBox.Text, this);
                nextForm.Show();
                this.Hide();
            }
        }
Beispiel #14
0
        // Регистрация со всеми проверками
        private void RegistrationButton_Click(object sender, EventArgs e)
        {
            Checking checking = new Checking();

            if (!checking.Login(LoginTextBox.Text))
            {
                PromptLabel.Text = "Не верный формат имени пользователя";
            }
            else if (!checking.Email(EmailTextBox.Text))
            {
                PromptLabel.Text = "Не верный формат e-mail";
            }
            else if (!checking.Password(PasswordTextBox.Text))
            {
                PromptLabel.Text = "Не верный формат пароля";
            }
            else if (PasswordTextBox.Text.CompareTo(RepeatPasswordTextBox.Text) != 0)
            {
                PromptLabel.Text = "Пароли не совпадают";
            }
            else if (!checking.LoginInBase(LoginTextBox.Text))
            {
                PromptLabel.Text = "Пользователь уже существует или проблема с базой";
            }
            else
            {
                string path = @"logins\" + LoginTextBox.Text[0] + ".txt";
                string text = LoginTextBox.Text + "|" + EmailTextBox.Text + "|" + PasswordTextBox.Text + "\r\n";
                try
                {
                    File.AppendAllText(path, text);
                    path = @"users_lists\" + LoginTextBox.Text + ".txt";
                    using (StreamWriter sw = new StreamWriter(path))
                    {
                        sw.Write("");
                    }
                }
                catch
                {
                    MessageBox.Show("Простите, в работе с базой пользователей что-то пошло не так");
                    return;
                }
                PasswordTextBox.Clear();
                RepeatPasswordTextBox.Clear();
                LoginTextBox.Clear();
                EmailTextBox.Clear();
                PromptLabel.Text = "Вы успешно зарегистрированы";
            }
        }
 private void AuthenticationComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (AuthenticationComboBox.SelectedIndex == 0)
     {
         LoginTextBox.Clear();
         LoginTextBox.ReadOnly = true;
         PWDTextBox.Clear();
         PWDTextBox.ReadOnly = true;
     }
     else
     {
         LoginTextBox.ReadOnly = false;
         PWDTextBox.ReadOnly   = false;
     }
 }
 private void PasswordTextBox_KeyUp(object sender,
                                    KeyEventArgs e)
 {
     if (e.Key == Key.Enter || e.Key == Key.Down)
     {
         if (LoginButton.IsEnabled)
         {
             LoginButton_Click(this, new RoutedEventArgs());
         }
     }
     else if (e.Key == Key.Up)
     {
         LoginTextBox.Focus();
     }
 }
Beispiel #17
0
        private void SimpleLoginButton_Click(object sender, RoutedEventArgs e)
        {
            LoginTextBox.ClearValue(TextBox.BorderBrushProperty);
            LoginTextBox.ClearValue(TextBox.PlaceholderTextProperty);

            if (string.IsNullOrWhiteSpace(LoginTextBox.Text))
            {
                LoginTextBox.BorderBrush     = new SolidColorBrush(Colors.Red);
                LoginTextBox.PlaceholderText = "Login is required";
            }
            else if (LoginTextBox.Text.Length <= 3)
            {
                LoginTextBox.BorderBrush = new SolidColorBrush(Colors.Red);
            }
        }
Beispiel #18
0
 private void RegisterButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         mParent.mUser = mParent.mManager.Register(
             LoginTextBox.Text,
             Password.Password,
             NicknameTextBox.Text
             );
     }
     catch (UserNotRegisteredException)
     {
         LoginTextBox.Clear();
         // MessageBox
     }
 }
Beispiel #19
0
        /// <summary>
        /// Metoda obsługująca zdarzenie kliknięcia w przycisk RegisterBtn
        /// Metoda jest odpowiedzialna za procedurę rejestracji nowego użytkownika
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RegisterBtn_Click(object sender, EventArgs e)
        {
            string login, pwd, pesel;

            login = LoginTextBox.Text;
            pesel = maskedTextBox1.Text;
            pwd   = PwdTextBox.Text;
            if (!BindingModule.CheckPesel(pesel))
            {
                StatusLabel.Text = "Invalid Pesel";
                return;
            }
            if (LoginTextBox.Text == "" || maskedTextBox1.Text == "" ||
                PwdTextBox.Text == "" || ConfPwdTextBox.Text == "")
            {
                //RegisterBtn.Enabled = false;
                StatusLabel.Text = "Provide more information";
                return;
            }
            if (pwd.Equals(ConfPwdTextBox.Text))
            {
                //wyslac ponizsze i poczekac na odpowiedz
                bool response = SendRegisterMsg(login, CryptoModule.HashMessage(pwd), CryptoModule.HashMessage(pesel));

                if (response)
                {
                    StatusLabel.Text        = "Registration completed succesfully";
                    LoginTextBox.ReadOnly   = true;
                    maskedTextBox1.ReadOnly = true;
                    PwdTextBox.ReadOnly     = true;
                    ConfPwdTextBox.ReadOnly = true;
                    RegisterBtn.Enabled     = false;
                }
                else
                {
                    StatusLabel.Text = "Registration failed";
                    LoginTextBox.ResetText();
                    maskedTextBox1.ResetText();
                    PwdTextBox.ResetText();
                    ConfPwdTextBox.ResetText();
                }
            }
            else
            {
                StatusLabel.Text = "Passwords don't match";
            }
        }
Beispiel #20
0
        private void RegistrationButton_Click(object sender, RoutedEventArgs e)
        {
            string login  = LoginTextBox.Text;
            string onepwd = OnePasswordBox.Password;
            string twopwd = TwoPasswordBox.Password;

            if (login.Length != 0 && onepwd == twopwd)
            {
                if (CheckLogin(login))
                {
                    string hash_login = GetHash(login);
                    string hash_pwd   = GetHash(onepwd + hash_login);
                    string hash_sn    = GetHash(serial_numbers[0] + hash_login);
                    string data_auth  = login + ":" + hash_pwd + ":" + hash_sn + ":";

                    //Запись в файл
                    using (FileStream fstream = new FileStream("database", FileMode.Append))
                    {
                        byte[] array = System.Text.Encoding.Default.GetBytes(data_auth);
                        fstream.Write(array, 0, array.Length);
                    }

                    MessageBox.Show("Регистрация успешно пройдена!", "", MessageBoxButton.OK, MessageBoxImage.Information);

                    LoginTextBox.Clear();
                    OnePasswordBox.Clear();
                    TwoPasswordBox.Clear();
                    CheckButton.IsEnabled        = true;
                    RegistrationButton.IsEnabled = false;
                }
                else
                {
                    MessageBox.Show("Выбранный логин используется!", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                if (login.Length == 0)
                {
                    MessageBox.Show("Введите логин!", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    MessageBox.Show("Пароли не совпадают!", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
        }
Beispiel #21
0
        public DashboardPage NavigateToDashboardPage(string user, string pwd)
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.Name("loginfmt")));
            LoginTextBox.SendKeys(user);
            SubmitButton.Click();
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.Id("idA_PWD_ForgotPassword")));
            PasswdTextBox.SendKeys(pwd);
            Thread.Sleep(1000);
            SubmitButton.Click();
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.Name("DontShowAgain")));
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.XPath("//input[@type='submit']")));
            SubmitButton.Click();
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.TitleIs("Gea"));
            return(new DashboardPage(driver));
        }
        protected override void OnExit(object sender,
                                       RoutedEventArgs e)
        {
            base.OnExit(sender, e);

            _changeNicknameExplicit = false;

            LoginTextBox.Clear();
            PasswordTextBox.Clear();
            NicknameTextBox.Clear();

            if (!IsOnExitActive)
            {
                e.Handled = true;
                return;
            }
        }
        private bool ValidateForm()
        {
            if (!Regex.Match(LoginTextBox.Text, @"^\D{6,20}$").Success)
            {
                MessageBox.Show("Login must consist of at least 6 characters and not exceed 20 characters!");
                LoginTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(PasswordTextBox.Password, @"^\D{6,20}$").Success)
            {
                MessageBox.Show("Password must consist of at least 6 characters and not exceed 20 characters!");
                LoginTextBox.Focus();
                return(false);
            }

            return(true);
        }
        private void PasswordBox_OnKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }

            if (!string.IsNullOrEmpty(PasswordBox.Password))
            {
                if (!string.IsNullOrEmpty(LoginTextBox.Text))
                {
                    _viewModel.LoginCommand.Execute(null);
                }
                else
                {
                    LoginTextBox.Focus();
                }
            }
        }
        protected override void OnExit(object sender,
                                       RoutedEventArgs e)
        {
            base.OnExit(sender, e);

            _autoUpdateStatusesTimer.Stop();

            LoginTextBox.Clear();
            PasswordTextBox.Clear();

            RememberMeCheckBox.IsChecked       = false;
            OpenStoredAccountsButton.IsChecked = false;

            if (!IsOnExitActive)
            {
                e.Handled = true;
                return;
            }
        }
        private void PasswordBox_OnKeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
        {
            if (e.Key != VirtualKey.Enter)
            {
                return;
            }

            if (!string.IsNullOrWhiteSpace(PasswordBox.Password))
            {
                if (string.IsNullOrWhiteSpace(LoginTextBox.Text))
                {
                    LoginTextBox.Focus(Windows.UI.Xaml.FocusState.Keyboard);
                }
                else
                {
                    ViewModel.LoginCommand.Execute(null);
                }
            }
        }
Beispiel #27
0
 private void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(LoginTextBox.Text) && !string.IsNullOrEmpty(PasswordBox.Password))
     {
         if (service.SignIn(LoginTextBox.Text, PasswordBox.Password, out string message, out User user))
         {
             var userWindow = new UserWindow(service, user);
             Hide();
             userWindow.ShowDialog();
             Show();
         }
         else
         {
             MessageBox.Show(message);
             LoginTextBox.Clear();
             PasswordBox.Clear();
             LoginTextBox.Focus();
         }
     }
Beispiel #28
0
 //Edycja uzytkownika/karty
 public OknoDodawania(OknoAdmina _OA, string _UID, string Imie, string Nazwisko)
 {
     InitializeComponent();
     akcja                = "k";
     AddButton.Text       = "Edytuj";
     LabelID.Text         = "UID";
     UID                  = _UID;
     UIDtextBox.Text      = UID;
     ImieTextBox.Text     = Imie;
     NazwiskoTextBox.Text = Nazwisko;
     EditCheckBox.Checked = true;
     EditCheckBox.Enabled = false;
     OA = _OA;
     //chowamy elementy przydatne przy dodawaniu studentow
     LabelHaslo.Hide();
     LabelLogin.Hide();
     LoginTextBox.Hide();
     HasloTextBox.Hide();
     repeatHasloTextBox.Hide();
 }
        private void signInButton_Click(object sender, RoutedEventArgs e)
        {
            if (LoginTextBox.Text == "" || PasswordPasswordBox.Password == "")
            {
                return;
            }
            _loading = new Loading(this);
            _loading.Show();

            ConnectionSocket = Functions.ReturnNewSocket(ConnectionSocket);
            Functions.SerializeAndSend(new Authorization(LoginTextBox.Text, PasswordPasswordBox.Password), ConnectionSocket);

            object obj;

            {
                byte[] byteBuffer = new byte[1024];
                if (ConnectionSocket.Receive(byteBuffer) == 0)
                {
                    MessageBox.Show("Получено 0 байт");
                }
                obj = Functions.Deserialize(byteBuffer);
            }
            if (!(obj is AccountInformation))
            {
                return;
            }
            AccountInformation accountInf = obj as AccountInformation;

            if (accountInf.IsNull)
            {
                MessageBox.Show("Ошибка в логине или пароле!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
                _loading.Close();
                LoginTextBox.Focus();
            }
            else
            {
                _whetherToCreate = true;
                _ai = accountInf;
                Close();
            }
        }
Beispiel #30
0
 //Dodawanie uzytkownika/karty
 public OknoDodawania(OknoAdmina _OA, string _akcja)
 {
     InitializeComponent();
     akcja          = _akcja;
     OA             = _OA;
     AddButton.Text = "Dodaj";
     if (akcja == "k")//chowamy elementy przydatne przy dodawaniu wykladowcow
     {
         LabelID.Text = "UID";
         LabelHaslo.Hide();
         LabelLogin.Hide();
         LoginTextBox.Hide();
         HasloTextBox.Hide();
         repeatHasloTextBox.Hide();
     }
     else if (akcja == "w")
     {
         UIDtextBox.Enabled = false;
         LabelID.Text       = "ID";
     }
 }