From 30306a775af74e1fe080590998a71a4c7e64ad12 Mon Sep 17 00:00:00 2001 From: randomhuman Date: Sun, 5 Sep 2010 21:44:46 +0100 Subject: Made it impossible to create a user with names containing spaces and prevented passwords from being echoed after enter is pressed. --- OpenSim/Framework/Console/ConsoleBase.cs | 51 +++++++++++++++++++++++++++++++ OpenSim/Framework/Console/LocalConsole.cs | 5 +-- 2 files changed, 54 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index aab920b..22ce880 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console return ret; } + + public string CmdPrompt(string p, List excludedCharacters) + { + bool itisdone = false; + string ret = String.Empty; + while (!itisdone) + { + itisdone = true; + ret = CmdPrompt(p); + + foreach (char c in excludedCharacters) + { + if (ret.Contains(c.ToString())) + { + System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted."); + itisdone = false; + } + } + } + + return ret; + } + + public string CmdPrompt(string p, string def, List excludedCharacters) + { + bool itisdone = false; + string ret = String.Empty; + while (!itisdone) + { + itisdone = true; + ret = CmdPrompt(p, def); + + if (ret == String.Empty) + { + ret = def; + } + else + { + foreach (char c in excludedCharacters) + { + if (ret.Contains(c.ToString())) + { + System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted."); + itisdone = false; + } + } + } + } + + return ret; + } // Displays a command prompt and returns a default value, user may only enter 1 of 2 options public string CmdPrompt(string prompt, string defaultresponse, List options) diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index a3036d0..c968031 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console SetCursorLeft(0); y = SetCursorTop(y); - System.Console.WriteLine("{0}{1}", prompt, cmdline); + System.Console.WriteLine(); + //Show(); lock (cmdline) { @@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console } } - AddToHistory(cmdline.ToString()); + //AddToHistory(cmdline.ToString()); return cmdline.ToString(); default: break; -- cgit v1.1