private OSDMap ChangePassword(OSDMap map)
{
OSDMap resp = new OSDMap();
string Password = map["Password"].AsString();
string newPassword = map["NewPassword"].AsString();
UUID userID = map["UUID"].AsUUID();
ILoginService loginService = m_registry.RequestModuleInterface<ILoginService>();
IUserAccountService accountService = m_registry.RequestModuleInterface<IUserAccountService>();
IAuthenticationService auths = m_registry.RequestModuleInterface<IAuthenticationService>();
UserAccount account = accountService.GetUserAccount(null, userID);
//Null means it went through without an error
bool Verified = loginService.VerifyClient(account.PrincipalID, account.Name, "UserAccount", Password);
if ((auths.Authenticate(userID, "UserAccount", Password.StartsWith("$1$") ? Password.Remove(0, 3) : Util.Md5Hash(Password), 100) != string.Empty) && (Verified))
{
auths.SetPasswordHashed(userID, "UserAccount", newPassword.StartsWith("$1$") ? newPassword.Remove(0, 3) : Util.Md5Hash(newPassword));
resp["Verified"] = OSD.FromBoolean(Verified);
}
return resp;
}