public static string NewPassword() { bool includeLowercase = true; bool includeUppercase = true; bool includeNumeric = true; bool includeSpecial = true; bool includeSpaces = false; int lengthOfPassword = 12; string password = PasswordGenerator.GeneratePassword(includeLowercase, includeUppercase, includeNumeric, includeSpecial, includeSpaces, lengthOfPassword); while (!PasswordGenerator.PasswordIsValid(includeLowercase, includeUppercase, includeNumeric, includeSpecial, includeSpaces, password)) { password = PasswordGenerator.GeneratePassword(includeLowercase, includeUppercase, includeNumeric, includeSpecial, includeSpaces, lengthOfPassword); } return(password); }
public void PasswordGene() { Console.SetWindowSize(100, 30); Console.SetBufferSize(100, 30); Colors set = new Colors(); Kit set2 = new Kit(); set.DoIt(); Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("\n\n=== Password has been copied to the clipboard. Press any key to continue... ==="); Clipboard.SetText(PasswordGenerator.NewPassword()); Console.ReadKey(); //set2.Short_menu(); }
private void addButton_Click(object sender, System.EventArgs e) { if (String.IsNullOrEmpty(textBoxAddUserLDAP.Text)) { MessageBox.Show("Enter user account name please.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string fileName = "addUser_" + textBoxAddUserLDAP.Text + ".txt"; string[] lines = { "userName="******"password="******"C:\EDI\", fileName); File.WriteAllLines(path, lines); MessageBox.Show(@"File has been created in C:\EDI\", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonGenerateRandomPassword_Click(object sender, EventArgs e) { Clipboard.SetText(PasswordGenerator.NewPassword()); MessageBox.Show("=== Password has been copied to the clipboard. ===", "myEDI", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void DoIt() { WriteConsoleColor(new ColoredString(ConsoleColor.DarkYellow, "\nMy password is: ")); WriteConsoleColor(new ColoredString(ConsoleColor.Red, PasswordGenerator.NewPassword())); }