Adding command to reset user's email address

mb-throttle-test
BlueWall 2014-12-16 12:20:56 -05:00
parent 147d401b28
commit b39d697555
1 changed files with 43 additions and 1 deletions

View File

@ -98,7 +98,12 @@ namespace OpenSim.Services.UserAccountService
MainConsole.Instance.Commands.AddCommand("Users", false, MainConsole.Instance.Commands.AddCommand("Users", false,
"reset user password", "reset user password",
"reset user password [<first> [<last> [<password>]]]", "reset user password [<first> [<last> [<password>]]]",
"Reset a user password", HandleResetUserPassword); "Reset a user password", HandleResetUserPassword);
MainConsole.Instance.Commands.AddCommand("Users", false,
"reset user email",
"reset user email [<first> [<last> [<email>]]]",
"Reset a user email address", HandleResetUserEmail);
MainConsole.Instance.Commands.AddCommand("Users", false, MainConsole.Instance.Commands.AddCommand("Users", false,
"set user level", "set user level",
@ -420,6 +425,43 @@ namespace OpenSim.Services.UserAccountService
MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName); MainConsole.Instance.OutputFormat("Password reset for user {0} {1}", firstName, lastName);
} }
protected void HandleResetUserEmail(string module, string[] cmdparams)
{
string firstName;
string lastName;
string newEmail;
if (cmdparams.Length < 4)
firstName = MainConsole.Instance.CmdPrompt("First name");
else firstName = cmdparams[3];
if (cmdparams.Length < 5)
lastName = MainConsole.Instance.CmdPrompt("Last name");
else lastName = cmdparams[4];
if (cmdparams.Length < 6)
newEmail = MainConsole.Instance.PasswdPrompt("New Email");
else newEmail = cmdparams[5];
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (account == null)
{
MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName);
return;
}
bool success = false;
account.Email = newEmail;
success = StoreUserAccount(account);
if (!success)
MainConsole.Instance.OutputFormat("Unable to set Email for account {0} {1}.", firstName, lastName);
else
MainConsole.Instance.OutputFormat("User Email set for user {0} {1} to {2}", firstName, lastName, account.Email);
}
protected void HandleSetUserLevel(string module, string[] cmdparams) protected void HandleSetUserLevel(string module, string[] cmdparams)
{ {
string firstName; string firstName;