public static CreateSecureString ( string data ) : |
||
data | string | string to be converted |
return |
/// <summary> /// get credentials /// </summary> private static void GetCredentials() { ConsoleKeyInfo key; bool retryUserNameInput = false; string account = String.Empty; string password = String.Empty; do { System.Console.WriteLine(@"Please enter the Admin account: "); System.Console.WriteLine(@"- Use [domain\alias] for SPO-D & On-Prem farms"); System.Console.WriteLine(@"- Use [[email protected]] for SPO-MT & vNext farms"); account = System.Console.ReadLine(); if (account.Contains('\\')) { string [] segments = account.Split('\\'); AdminDomain = segments[0]; AdminUsername = segments[1]; break; } if (account.Contains("@")) { AdminUsername = account; break; } }while (retryUserNameInput); System.Console.WriteLine("Please enter the Admin password: "******"*"); } else if (key.Key == ConsoleKey.Backspace) { if (password.Length > 0) { password = password.Substring(0, password.Length - 1); System.Console.CursorLeft--; System.Console.Write('\0'); System.Console.CursorLeft--; } } }while (key.Key != ConsoleKey.Enter); AdminPassword = Helper.CreateSecureString(password.TrimEnd('\r')); }