* Add "reset user password" command to standalone region console
* Grid user server implementation to follow shortly0.6.0-stable
parent
bf8b70ebeb
commit
6d289c3ae0
|
@ -257,6 +257,18 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reset a user password
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="firstName"></param>
|
||||||
|
/// <param name="lastName"></param>
|
||||||
|
/// <param name="newPassword"></param>
|
||||||
|
/// <returns>true if the update was successful, false otherwise</returns>
|
||||||
|
public bool ResetUserPassword(string firstName, string lastName, string newPassword)
|
||||||
|
{
|
||||||
|
return m_userService.ResetUserPassword(firstName, lastName, newPassword);
|
||||||
|
}
|
||||||
|
|
||||||
#region Friend Methods
|
#region Friend Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Framework.Communications
|
||||||
UserProfileData SetupMasterUser(UUID userId);
|
UserProfileData SetupMasterUser(UUID userId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Add a new user profile
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
|
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
|
||||||
|
@ -72,6 +72,15 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <returns>true if the update could be applied, false if it could not be applied.</returns>
|
/// <returns>true if the update could be applied, false if it could not be applied.</returns>
|
||||||
bool UpdateUserProfile(UserProfileData data);
|
bool UpdateUserProfile(UserProfileData data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reset a user password
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="firstName"></param>
|
||||||
|
/// <param name="lastName"></param>
|
||||||
|
/// <param name="newPassword"></param>
|
||||||
|
/// <returns>true if the update was successful, false otherwise</returns>
|
||||||
|
bool ResetUserPassword(string firstName, string lastName, string newPassword);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new friend to the database for XUser
|
/// Adds a new friend to the database for XUser
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -361,8 +361,6 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="request">The users loginrequest</param>
|
/// <param name="request">The users loginrequest</param>
|
||||||
public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
|
public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
|
||||||
|
|
||||||
UserAgentData agent = new UserAgentData();
|
UserAgentData agent = new UserAgentData();
|
||||||
|
|
||||||
// User connection
|
// User connection
|
||||||
|
@ -575,6 +573,33 @@ namespace OpenSim.Framework.Communications
|
||||||
return user.ID;
|
return user.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reset a user password
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="firstName"></param>
|
||||||
|
/// <param name="lastName"></param>
|
||||||
|
/// <param name="newPassword"></param>
|
||||||
|
/// <returns>true if the update was successful, false otherwise</returns>
|
||||||
|
public bool ResetUserPassword(string firstName, string lastName, string newPassword)
|
||||||
|
{
|
||||||
|
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(newPassword) + ":" + String.Empty);
|
||||||
|
|
||||||
|
UserProfileData profile = GetUserProfile(firstName, lastName);
|
||||||
|
|
||||||
|
if (null == profile)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USERSTORAGE]: Could not find user {0} {1}", firstName, lastName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.PasswordHash = md5PasswdHash;
|
||||||
|
profile.PasswordSalt = String.Empty;
|
||||||
|
|
||||||
|
UpdateUserProfile(profile);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool UpdateUserProfileProperties(UserProfileData UserProfile)
|
public bool UpdateUserProfileProperties(UserProfileData UserProfile)
|
||||||
{
|
{
|
||||||
if (null == GetUserProfile(UserProfile.ID))
|
if (null == GetUserProfile(UserProfile.ID))
|
||||||
|
|
|
@ -283,6 +283,7 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
m_console.Notice("");
|
m_console.Notice("");
|
||||||
m_console.Notice("create user - adds a new user.");
|
m_console.Notice("create user - adds a new user.");
|
||||||
|
m_console.Notice("reset user password - reset a user's password.");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -494,6 +495,10 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "reset":
|
||||||
|
Reset(cmdparams);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
string[] tmpPluginArgs = new string[cmdparams.Length + 1];
|
string[] tmpPluginArgs = new string[cmdparams.Length + 1];
|
||||||
cmdparams.CopyTo(tmpPluginArgs, 1);
|
cmdparams.CopyTo(tmpPluginArgs, 1);
|
||||||
|
@ -544,6 +549,30 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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>
|
/// <summary>
|
||||||
/// Turn on some debugging values for OpenSim.
|
/// Turn on some debugging values for OpenSim.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -650,6 +679,7 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
m_console.Notice("");
|
m_console.Notice("");
|
||||||
m_console.Notice("create user - adds a new user.");
|
m_console.Notice("create user - adds a new user.");
|
||||||
|
m_console.Notice("reset user password - reset a user's password.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,6 +800,31 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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_commsManager.ResetUserPassword(firstName, lastName, newPassword);
|
||||||
|
}
|
||||||
|
|
||||||
protected void SaveXml(string[] cmdparams)
|
protected void SaveXml(string[] cmdparams)
|
||||||
{
|
{
|
||||||
m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
|
m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
|
||||||
|
|
|
@ -470,6 +470,11 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ResetUserPassword(string firstName, string lastName, string newPassword)
|
||||||
|
{
|
||||||
|
throw new Exception("The method or operation is not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public bool UpdateUserProfile(UserProfileData data)
|
public bool UpdateUserProfile(UserProfileData data)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue