* 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.
0.6.0-stable
Justin Clarke Casey 2008-09-15 19:17:10 +00:00
parent ddaa90d270
commit d0aabcb186
1 changed files with 55 additions and 2 deletions

View File

@ -220,6 +220,55 @@ namespace OpenSim.Grid.UserServer
break;
}
}
/// <summary>
/// Execute switch for some of the reset commands
/// </summary>
/// <param name="args"></param>
protected void Reset(string[] args)
{
if (args.Length == 0)
return;
switch (args[0])
{
case "user":
switch (args[1])
{
case "password":
ResetUserPassword(args);
break;
}
break;
}
}
/// <summary>
/// Reset a user password.
/// </summary>
/// <param name="cmdparams"></param>
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<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
@ -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 <firstname> <lastname> <message> - logs off the specified user from the grid");
m_console.Notice("logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid");
m_console.Notice("reset user password - reset a user's password.");
}
public override void Shutdown()