From d0aabcb1868ba5e3a2b40d007709d18405d06ae7 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 15 Sep 2008 19:17:10 +0000
Subject: * 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.
---
OpenSim/Grid/UserServer/Main.cs | 57 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Grid')
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
break;
}
}
+
+ ///
+ /// Execute switch for some of the reset commands
+ ///
+ ///
+ protected void Reset(string[] args)
+ {
+ if (args.Length == 0)
+ return;
+
+ switch (args[0])
+ {
+ case "user":
+
+ switch (args[1])
+ {
+ case "password":
+ ResetUserPassword(args);
+ break;
+ }
+
+ break;
+ }
+ }
+
+ ///
+ /// Reset a user password.
+ ///
+ ///
+ private void ResetUserPassword(string[] cmdparams)
+ {
+ string firstName;
+ string lastName;
+ string newPassword;
+
+ if (cmdparams.Length < 3)
+ firstName = MainConsole.Instance.CmdPrompt("First name");
+ else firstName = cmdparams[2];
+
+ if ( cmdparams.Length < 4 )
+ lastName = MainConsole.Instance.CmdPrompt("Last name");
+ else lastName = cmdparams[3];
+
+ if ( cmdparams.Length < 5 )
+ newPassword = MainConsole.Instance.PasswdPrompt("New password");
+ else newPassword = cmdparams[4];
+
+ m_userManager.ResetUserPassword(firstName, lastName, newPassword);
+ }
public override void RunCmd(string cmd, string[] cmdparams)
{
@@ -230,6 +279,10 @@ namespace OpenSim.Grid.UserServer
case "create":
do_create(cmdparams[0]);
break;
+
+ case "reset":
+ Reset(cmdparams);
+ break;
case "test-inventory":
// RestObjectPosterResponse> requester = new RestObjectPosterResponse>();
@@ -309,8 +362,8 @@ namespace OpenSim.Grid.UserServer
base.ShowHelp(helpArgs);
m_console.Notice("create user - create a new user");
- m_console.Notice(
- "logoff-user - logs off the specified user from the grid");
+ m_console.Notice("logoff-user - logs off the specified user from the grid");
+ m_console.Notice("reset user password - reset a user's password.");
}
public override void Shutdown()
--
cgit v1.1