* 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
parent
ddaa90d270
commit
d0aabcb186
|
@ -221,6 +221,55 @@ namespace OpenSim.Grid.UserServer
|
|||
}
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
base.RunCmd(cmd, cmdparams);
|
||||
|
@ -231,6 +280,10 @@ namespace OpenSim.Grid.UserServer
|
|||
do_create(cmdparams[0]);
|
||||
break;
|
||||
|
||||
case "reset":
|
||||
Reset(cmdparams);
|
||||
break;
|
||||
|
||||
case "test-inventory":
|
||||
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
|
||||
// requester.ReturnResponseVal = TestResponse;
|
||||
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue