aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Application/OpenSim.cs47
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs37
2 files changed, 37 insertions, 47 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 787d025..31cc610 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -347,13 +347,6 @@ namespace OpenSim
347 "kill uuid <UUID>", 347 "kill uuid <UUID>",
348 "Kill an object by UUID", KillUUID); 348 "Kill an object by UUID", KillUUID);
349 349
350 if (ConfigurationSettings.Standalone)
351 {
352
353 m_console.Commands.AddCommand("region", false, "reset user password",
354 "reset user password [<first> [<last> [<password>]]]",
355 "Reset a user password", HandleResetUserPassword);
356 }
357 350
358 m_console.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", 351 m_console.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
359 "Set local coordinate to map HG regions to", RunCommand); 352 "Set local coordinate to map HG regions to", RunCommand);
@@ -809,21 +802,6 @@ namespace OpenSim
809 m_console.ConsoleScene = m_sceneManager.CurrentScene; 802 m_console.ConsoleScene = m_sceneManager.CurrentScene;
810 } 803 }
811 804
812 /// <summary>
813 /// Execute switch for some of the reset commands
814 /// </summary>
815 /// <param name="args"></param>
816 protected void HandleResetUserPassword(string module, string[] cmd)
817 {
818 if (ConfigurationSettings.Standalone)
819 {
820 ResetUserPassword(cmd);
821 }
822 else
823 {
824 m_log.Info("Reset user password is not available in grid mode, use the user-server.");
825 }
826 }
827 805
828 /// <summary> 806 /// <summary>
829 /// Turn on some debugging values for OpenSim. 807 /// Turn on some debugging values for OpenSim.
@@ -1057,31 +1035,6 @@ namespace OpenSim
1057 } 1035 }
1058 1036
1059 /// <summary> 1037 /// <summary>
1060 /// Reset a user password.
1061 /// </summary>
1062 /// <param name="cmdparams"></param>
1063 private void ResetUserPassword(string[] cmdparams)
1064 {
1065 string firstName;
1066 string lastName;
1067 string newPassword;
1068
1069 if (cmdparams.Length < 4)
1070 firstName = MainConsole.Instance.CmdPrompt("First name");
1071 else firstName = cmdparams[3];
1072
1073 if (cmdparams.Length < 5)
1074 lastName = MainConsole.Instance.CmdPrompt("Last name");
1075 else lastName = cmdparams[4];
1076
1077 if (cmdparams.Length < 6)
1078 newPassword = MainConsole.Instance.PasswdPrompt("New password");
1079 else newPassword = cmdparams[5];
1080
1081 m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword);
1082 }
1083
1084 /// <summary>
1085 /// Use XML2 format to serialize data to a file 1038 /// Use XML2 format to serialize data to a file
1086 /// </summary> 1039 /// </summary>
1087 /// <param name="module"></param> 1040 /// <param name="module"></param>
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 8f78813..90077d8 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -76,6 +76,10 @@ namespace OpenSim.Services.UserAccountService
76 "create user", 76 "create user",
77 "create user [<first> [<last> [<pass> [<email>]]]]", 77 "create user [<first> [<last> [<pass> [<email>]]]]",
78 "Create a new user", HandleCreateUser); 78 "Create a new user", HandleCreateUser);
79 MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password",
80 "reset user password [<first> [<last> [<password>]]]",
81 "Reset a user password", HandleResetUserPassword);
82
79 } 83 }
80 84
81 } 85 }
@@ -292,6 +296,39 @@ namespace OpenSim.Services.UserAccountService
292 } 296 }
293 297
294 } 298 }
299
300 protected void HandleResetUserPassword(string module, string[] cmdparams)
301 {
302 string firstName;
303 string lastName;
304 string newPassword;
305
306 if (cmdparams.Length < 4)
307 firstName = MainConsole.Instance.CmdPrompt("First name");
308 else firstName = cmdparams[3];
309
310 if (cmdparams.Length < 5)
311 lastName = MainConsole.Instance.CmdPrompt("Last name");
312 else lastName = cmdparams[4];
313
314 if (cmdparams.Length < 6)
315 newPassword = MainConsole.Instance.PasswdPrompt("New password");
316 else newPassword = cmdparams[5];
317
318 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
319 if (account == null)
320 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user");
321
322 bool success = false;
323 if (m_AuthenticationService != null)
324 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
325 if (!success)
326 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.",
327 firstName, lastName);
328 else
329 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
330 }
331
295 #endregion 332 #endregion
296 333
297 } 334 }