diff options
author | Justin Clarke Casey | 2008-09-15 19:17:10 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-09-15 19:17:10 +0000 |
commit | d0aabcb1868ba5e3a2b40d007709d18405d06ae7 (patch) | |
tree | d9ea426cd043de6296674b0be06bd62951839a6c /OpenSim/Grid | |
parent | * refactor: collapse UpdateUserProfileProperties() into existing UpdateUserPr... (diff) | |
download | opensim-SC-d0aabcb1868ba5e3a2b40d007709d18405d06ae7.zip opensim-SC-d0aabcb1868ba5e3a2b40d007709d18405d06ae7.tar.gz opensim-SC-d0aabcb1868ba5e3a2b40d007709d18405d06ae7.tar.bz2 opensim-SC-d0aabcb1868ba5e3a2b40d007709d18405d06ae7.tar.xz |
* Add "reset user password" command to user server
* Some copy and pasting has occurred because it's difficult to properly refactor some bits at present. I'm very ashamed and it will disappear at some future point.
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 0a64925..55e681a 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -220,6 +220,55 @@ namespace OpenSim.Grid.UserServer | |||
220 | break; | 220 | break; |
221 | } | 221 | } |
222 | } | 222 | } |
223 | |||
224 | /// <summary> | ||
225 | /// Execute switch for some of the reset commands | ||
226 | /// </summary> | ||
227 | /// <param name="args"></param> | ||
228 | protected void Reset(string[] args) | ||
229 | { | ||
230 | if (args.Length == 0) | ||
231 | return; | ||
232 | |||
233 | switch (args[0]) | ||
234 | { | ||
235 | case "user": | ||
236 | |||
237 | switch (args[1]) | ||
238 | { | ||
239 | case "password": | ||
240 | ResetUserPassword(args); | ||
241 | break; | ||
242 | } | ||
243 | |||
244 | break; | ||
245 | } | ||
246 | } | ||
247 | |||
248 | /// <summary> | ||
249 | /// Reset a user password. | ||
250 | /// </summary> | ||
251 | /// <param name="cmdparams"></param> | ||
252 | private void ResetUserPassword(string[] cmdparams) | ||
253 | { | ||
254 | string firstName; | ||
255 | string lastName; | ||
256 | string newPassword; | ||
257 | |||
258 | if (cmdparams.Length < 3) | ||
259 | firstName = MainConsole.Instance.CmdPrompt("First name"); | ||
260 | else firstName = cmdparams[2]; | ||
261 | |||
262 | if ( cmdparams.Length < 4 ) | ||
263 | lastName = MainConsole.Instance.CmdPrompt("Last name"); | ||
264 | else lastName = cmdparams[3]; | ||
265 | |||
266 | if ( cmdparams.Length < 5 ) | ||
267 | newPassword = MainConsole.Instance.PasswdPrompt("New password"); | ||
268 | else newPassword = cmdparams[4]; | ||
269 | |||
270 | m_userManager.ResetUserPassword(firstName, lastName, newPassword); | ||
271 | } | ||
223 | 272 | ||
224 | public override void RunCmd(string cmd, string[] cmdparams) | 273 | public override void RunCmd(string cmd, string[] cmdparams) |
225 | { | 274 | { |
@@ -230,6 +279,10 @@ namespace OpenSim.Grid.UserServer | |||
230 | case "create": | 279 | case "create": |
231 | do_create(cmdparams[0]); | 280 | do_create(cmdparams[0]); |
232 | break; | 281 | break; |
282 | |||
283 | case "reset": | ||
284 | Reset(cmdparams); | ||
285 | break; | ||
233 | 286 | ||
234 | case "test-inventory": | 287 | case "test-inventory": |
235 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); | 288 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); |
@@ -309,8 +362,8 @@ namespace OpenSim.Grid.UserServer | |||
309 | base.ShowHelp(helpArgs); | 362 | base.ShowHelp(helpArgs); |
310 | 363 | ||
311 | m_console.Notice("create user - create a new user"); | 364 | m_console.Notice("create user - create a new user"); |
312 | m_console.Notice( | 365 | m_console.Notice("logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid"); |
313 | "logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid"); | 366 | m_console.Notice("reset user password - reset a user's password."); |
314 | } | 367 | } |
315 | 368 | ||
316 | public override void Shutdown() | 369 | public override void Shutdown() |