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 --- .../Communications/CommunicationsManager.cs | 12 +++++++++ OpenSim/Framework/Communications/IUserService.cs | 11 +++++++- .../Framework/Communications/UserManagerBase.cs | 29 ++++++++++++++++++++-- 3 files changed, 49 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 969bdd8..1ac5fe4 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -256,6 +256,18 @@ namespace OpenSim.Framework.Communications return userProf.ID; } } + + /// + /// Reset a user password + /// + /// + /// + /// + /// true if the update was successful, false otherwise + public bool ResetUserPassword(string firstName, string lastName, string newPassword) + { + return m_userService.ResetUserPassword(firstName, lastName, newPassword); + } #region Friend Methods diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index 7e3c77b..d52d1ea 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs @@ -59,7 +59,7 @@ namespace OpenSim.Framework.Communications UserProfileData SetupMasterUser(UUID userId); /// - /// + /// Add a new user profile /// /// UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); @@ -71,6 +71,15 @@ namespace OpenSim.Framework.Communications /// via a call to GetUserProfile(). /// true if the update could be applied, false if it could not be applied. bool UpdateUserProfile(UserProfileData data); + + /// + /// Reset a user password + /// + /// + /// + /// + /// true if the update was successful, false otherwise + bool ResetUserPassword(string firstName, string lastName, string newPassword); /// /// Adds a new friend to the database for XUser diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 75c4dc1..4fc2fea 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -361,8 +361,6 @@ namespace OpenSim.Framework.Communications /// The users loginrequest public void CreateAgent(UserProfileData profile, XmlRpcRequest request) { - Hashtable requestData = (Hashtable) request.Params[0]; - UserAgentData agent = new UserAgentData(); // User connection @@ -574,6 +572,33 @@ namespace OpenSim.Framework.Communications return user.ID; } + + /// + /// Reset a user password + /// + /// + /// + /// + /// true if the update was successful, false otherwise + 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) { -- cgit v1.1