Made it impossible to create a user with names containing spaces and prevented passwords from being echoed after enter is pressed.
parent
29708e47a5
commit
30306a775a
|
@ -90,6 +90,57 @@ namespace OpenSim.Framework.Console
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CmdPrompt(string p, List<char> 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<char> 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
|
// 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<string> options)
|
public string CmdPrompt(string prompt, string defaultresponse, List<string> options)
|
||||||
{
|
{
|
||||||
|
|
|
@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
|
||||||
SetCursorLeft(0);
|
SetCursorLeft(0);
|
||||||
y = SetCursorTop(y);
|
y = SetCursorTop(y);
|
||||||
|
|
||||||
System.Console.WriteLine("{0}{1}", prompt, cmdline);
|
System.Console.WriteLine();
|
||||||
|
//Show();
|
||||||
|
|
||||||
lock (cmdline)
|
lock (cmdline)
|
||||||
{
|
{
|
||||||
|
@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddToHistory(cmdline.ToString());
|
//AddToHistory(cmdline.ToString());
|
||||||
return cmdline.ToString();
|
return cmdline.ToString();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1159,8 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
|
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("The current estate has no owner set.");
|
MainConsole.Instance.Output("The current estate has no owner set.");
|
||||||
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test");
|
List<char> excluded = new List<char>(new char[1]{' '});
|
||||||
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User");
|
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
|
||||||
|
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
|
||||||
|
|
||||||
UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
|
UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
|
||||||
|
|
||||||
|
|
|
@ -297,12 +297,14 @@ namespace OpenSim.Services.UserAccountService
|
||||||
string password;
|
string password;
|
||||||
string email;
|
string email;
|
||||||
|
|
||||||
|
List<char> excluded = new List<char>(new char[]{' '});
|
||||||
|
|
||||||
if (cmdparams.Length < 3)
|
if (cmdparams.Length < 3)
|
||||||
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded);
|
||||||
else firstName = cmdparams[2];
|
else firstName = cmdparams[2];
|
||||||
|
|
||||||
if (cmdparams.Length < 4)
|
if (cmdparams.Length < 4)
|
||||||
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded);
|
||||||
else lastName = cmdparams[3];
|
else lastName = cmdparams[3];
|
||||||
|
|
||||||
if (cmdparams.Length < 5)
|
if (cmdparams.Length < 5)
|
||||||
|
|
Loading…
Reference in New Issue