private void Report_MouseDown(object sender, RoutedEventArgs e) { Console.WriteLine("Report mouse down"); VerificationComponent VC = new VerificationComponent(); List <string> report = VC.Report(Viewer); string temp = ""; for (int i = 0; i < report.Count; i++) { temp += " \n " + (i + 1).ToString() + " " + Viewer.Items[i] + " " + report[i] + "\n"; } /* * List<string> l = new List<string>(); * foreach (ListViewItem x in Viewer.Items) { * if (!l.Contains(x.Content)) * { * l.Add(x.Content); * } * else { * temp += "Duplicate passwords found"; * } * } */ Report.Text = temp; }
private void Register_Click(object sender, RoutedEventArgs e) { VerificationComponent VC = new VerificationComponent(); string m = ""; if (!VC.IsEmail(EmailBox.Text)) { m = " \n Email in bad format"; } if (VC.Verification(PasswordBox.Text) == "Valid Password" && m == "") { System.IO.StreamReader users2 = new System.IO.StreamReader(@"C:\Users\david\source\repos\PasswordValut\PasswordValut\UserList.txt"); string line = ""; List <string> Users = new List <string>(); while ((line = users2.ReadLine()) != null) { Users.Add(line); Console.WriteLine(line); } users2.Close(); if (!Users.Contains(EmailBox.Text)) { System.IO.StreamWriter users = new System.IO.StreamWriter(@"C:\Users\david\source\repos\PasswordValut\PasswordValut\UserList.txt", true); System.IO.StreamWriter passwords = new System.IO.StreamWriter(@"C:\Users\david\source\repos\PasswordValut\PasswordValut\PasswordList.txt", true); users.WriteLine(EmailBox.Text); passwords.WriteLine(PasswordBox.Text); users.Close(); passwords.Close(); var parentWindow = this.Parent as Window; if (parentWindow != null) { parentWindow.Close(); } // MainWindow Main = new MainWindow(); // Main.ShowDialog(); } else { Wrong.Visibility = Visibility.Visible; WrongLable.FontSize = 10; WrongLable.Content = "that email is already registered"; } } else { Wrong.Visibility = Visibility.Visible; WrongLable.FontSize = 10; WrongLable.Content = VC.Verification(PasswordBox.Text) + m; } }
// no code in email yet private void Register_Click(object sender, RoutedEventArgs e) { VerificationComponent VC = new VerificationComponent(); string m = ""; if (!VC.IsEmail(EmailBox.Text)) { m = " \n Email in bad format"; } if (VC.Verification(PasswordBox.Text).Contains("Valid") && m == "") { int result = 0; try { Conn.ConnectionString = constring; Conn.Open(); sql = @"select * from user_table "; cmd = new NpgsqlCommand(sql, Conn); Console.WriteLine(cmd.ExecuteScalar().ToString()); } catch { UseWrongLable("database error"); Console.WriteLine("database error"); } if (!cmd.ExecuteScalar().ToString().Contains(EmailBox.Text)) { Conn.Close(); EmptyUser = new User(Namebox.Text, EmailBox.Text); GenerationComponent GC = new GenerationComponent(); randomcode = GC.GeneratedPassword(15); EmailSystem emailSystem = new EmailSystem(EmptyUser, randomcode); emailSystem.Email(); Register.Visibility = Visibility.Hidden; CodeVerification.Visibility = Visibility.Visible; Wrong.Visibility = Visibility.Hidden; } else { Conn.Close(); UseWrongLable("that email is already registered"); } } else { UseWrongLable(VC.Verification(PasswordBox.Text) + m); } }
private void Refresh_Click(object sender, RoutedEventArgs e) { GenerationComponent GC = new GenerationComponent(); VerificationComponent VC = new VerificationComponent(); string newpass = GC.GeneratedPassword(GC.U.RNG(10, 13)); if (VC.Verification(newpass).Contains("Valid")) { PasswordGen.Text = newpass; } else { PasswordGen.Text = GC.GeneratedPassword(GC.U.RNG(10, 13)); } Console.WriteLine(PasswordGen.Text); }