aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserAccountService
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/UserAccountService')
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs37
1 files changed, 37 insertions, 0 deletions
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 }