From 6d289c3ae00b8d0f745d3345e8148b8d39b5206f Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 15 Sep 2008 17:29:11 +0000 Subject: * Add "reset user password" command to standalone region console * Grid user server implementation to follow shortly --- OpenSim/Region/Application/OpenSim.cs | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 4cf34bc..12ef129 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -283,6 +283,7 @@ namespace OpenSim { m_console.Notice(""); m_console.Notice("create user - adds a new user."); + m_console.Notice("reset user password - reset a user's password."); } break; @@ -493,6 +494,10 @@ namespace OpenSim m_commsManager.AddInventoryService(cmdparams[0]); } break; + + case "reset": + Reset(cmdparams); + break; default: string[] tmpPluginArgs = new string[cmdparams.Length + 1]; @@ -543,6 +548,30 @@ namespace OpenSim 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; + } + } /// /// Turn on some debugging values for OpenSim. @@ -650,6 +679,7 @@ namespace OpenSim { m_console.Notice(""); m_console.Notice("create user - adds a new user."); + m_console.Notice("reset user password - reset a user's password."); } } @@ -769,6 +799,31 @@ namespace OpenSim m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName); } } + + /// + /// 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_commsManager.ResetUserPassword(firstName, lastName, newPassword); + } protected void SaveXml(string[] cmdparams) { -- cgit v1.1