Example #1
0
        public bool unosLozinke(string lozinka)
        {
            var lozinka1 = new Password1();
            var lozinka2 = new Password2();
            var lozinka3 = new Password3();

            lozinka1.SetNext(lozinka2).SetNext(lozinka3);
            return(lozinka1.isAuthorised(lozinka));
        }
Example #2
0
        private void RegisterButtonSubmitClick(object sender, RoutedEventArgs e)
        {
            if (Password1.Password.Length > 4 && Password1.Password.Length < 10 && Password1.Password == Password2.Password && Name.Text.Length > 4 && Name.Text.Length < 16)
            {
                BinaryWriter writer = new BinaryWriter(App.getStream());
                BinaryReader reader = new BinaryReader(App.getStream());

                try
                {
                    string login    = Name.Text;
                    string password = Password1.Password.ToString();
                    writer.Write(2);
                    writer.Flush();
                    writer.Write(login);
                    writer.Flush();
                    writer.Write(password);
                    writer.Flush();


                    var res = reader.ReadInt32();
                    switch (res)
                    {
                    case 1:
                        MessageBox.Show("Ви успішно зареєструвалися");
                        Name.Clear();
                        Password1.Clear();
                        Password2.Clear();
                        break;

                    case 2:
                        MessageBox.Show("Користувач з таким логіном вже існує");
                        break;

                    case 0:
                        MessageBox.Show("Сталася помилка на сервері");
                        break;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something is wrong. \n\n\n" + ex.ToString());
                }
                finally
                {
                    writer.Close();
                    reader.Close();
                    App.closeClient();
                }
            }

            if (Name.Text == "")
            {
                NameErrorLabel.Content    = "Name is empty";
                NameErrorLabel.Visibility = Visibility.Visible;
            }

            if (Password1.Password.ToString() == "")
            {
                PasswordErrorLabel.Content    = "Password is empty";
                PasswordErrorLabel.Visibility = Visibility.Visible;
            }

            if (Password2.Password.ToString() == "")
            {
                Password2ErrorLabel.Content    = "Password is empty";
                Password2ErrorLabel.Visibility = Visibility.Visible;
            }
        }
Example #3
0
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Password1">A password.</param>
        /// <param name="Password2">Another password.</param>
        /// <returns>true|false</returns>
        public static Boolean operator !=(Password Password1, Password Password2)

        => !Password1.Equals(Password2);
Example #4
0
 private void Grid_Loaded(object sender, RoutedEventArgs e)
 {
     Login1.Clear();
     Password1.Clear();
     Error1.Opacity = 0;
 }
 public PasswordEnterWindow(CryptoFile cryptoFile)
 {
     InitializeComponent();
     this.cryptoFile = cryptoFile;
     Password1.Focus();
 }