aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorrandomhuman2010-09-05 21:44:46 +0100
committerJustin Clark-Casey (justincc)2010-09-10 23:19:18 +0100
commit30306a775af74e1fe080590998a71a4c7e64ad12 (patch)
treee1fc438132054d2b43cd6ff8ee133219bafad1dd
parentMerge branch 'prebuild-update' (diff)
downloadopensim-SC_OLD-30306a775af74e1fe080590998a71a4c7e64ad12.zip
opensim-SC_OLD-30306a775af74e1fe080590998a71a4c7e64ad12.tar.gz
opensim-SC_OLD-30306a775af74e1fe080590998a71a4c7e64ad12.tar.bz2
opensim-SC_OLD-30306a775af74e1fe080590998a71a4c7e64ad12.tar.xz
Made it impossible to create a user with names containing spaces and prevented passwords from being echoed after enter is pressed.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs51
-rw-r--r--OpenSim/Framework/Console/LocalConsole.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs6
4 files changed, 61 insertions, 6 deletions
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
89 89
90 return ret; 90 return ret;
91 } 91 }
92
93 public string CmdPrompt(string p, List<char> excludedCharacters)
94 {
95 bool itisdone = false;
96 string ret = String.Empty;
97 while (!itisdone)
98 {
99 itisdone = true;
100 ret = CmdPrompt(p);
101
102 foreach (char c in excludedCharacters)
103 {
104 if (ret.Contains(c.ToString()))
105 {
106 System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
107 itisdone = false;
108 }
109 }
110 }
111
112 return ret;
113 }
114
115 public string CmdPrompt(string p, string def, List<char> excludedCharacters)
116 {
117 bool itisdone = false;
118 string ret = String.Empty;
119 while (!itisdone)
120 {
121 itisdone = true;
122 ret = CmdPrompt(p, def);
123
124 if (ret == String.Empty)
125 {
126 ret = def;
127 }
128 else
129 {
130 foreach (char c in excludedCharacters)
131 {
132 if (ret.Contains(c.ToString()))
133 {
134 System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
135 itisdone = false;
136 }
137 }
138 }
139 }
140
141 return ret;
142 }
92 143
93 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options 144 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
94 public string CmdPrompt(string prompt, string defaultresponse, List<string> options) 145 public string CmdPrompt(string prompt, string defaultresponse, List<string> 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
461 SetCursorLeft(0); 461 SetCursorLeft(0);
462 y = SetCursorTop(y); 462 y = SetCursorTop(y);
463 463
464 System.Console.WriteLine("{0}{1}", prompt, cmdline); 464 System.Console.WriteLine();
465 //Show();
465 466
466 lock (cmdline) 467 lock (cmdline)
467 { 468 {
@@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
486 } 487 }
487 } 488 }
488 489
489 AddToHistory(cmdline.ToString()); 490 //AddToHistory(cmdline.ToString());
490 return cmdline.ToString(); 491 return cmdline.ToString();
491 default: 492 default:
492 break; 493 break;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7ce95a7..6fa78e0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1159,8 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes
1159 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 1159 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1160 { 1160 {
1161 MainConsole.Instance.Output("The current estate has no owner set."); 1161 MainConsole.Instance.Output("The current estate has no owner set.");
1162 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); 1162 List<char> excluded = new List<char>(new char[1]{' '});
1163 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); 1163 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
1164 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
1164 1165
1165 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); 1166 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
1166 1167
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 326e502..65c247f 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -296,13 +296,15 @@ namespace OpenSim.Services.UserAccountService
296 string lastName; 296 string lastName;
297 string password; 297 string password;
298 string email; 298 string email;
299
300 List<char> excluded = new List<char>(new char[]{' '});
299 301
300 if (cmdparams.Length < 3) 302 if (cmdparams.Length < 3)
301 firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); 303 firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded);
302 else firstName = cmdparams[2]; 304 else firstName = cmdparams[2];
303 305
304 if (cmdparams.Length < 4) 306 if (cmdparams.Length < 4)
305 lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); 307 lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded);
306 else lastName = cmdparams[3]; 308 else lastName = cmdparams[3];
307 309
308 if (cmdparams.Length < 5) 310 if (cmdparams.Length < 5)