private OSDMap Login(OSDMap map, bool asAdmin)
{
bool Verified = false;
string Name = map["Name"].AsString();
string Password = map["Password"].AsString();
ILoginService loginService = m_registry.RequestModuleInterface<ILoginService>();
IUserAccountService accountService = m_registry.RequestModuleInterface<IUserAccountService>();
UserAccount account = null;
OSDMap resp = new OSDMap ();
resp["Verified"] = OSD.FromBoolean(false);
if (accountService == null || CheckIfUserExists(map)["Verified"] != true)
{
return resp;
}
account = m_registry.RequestModuleInterface<IUserAccountService>().GetUserAccount(null, Name);
//Null means it went through without an errorz
if (loginService.VerifyClient(account.PrincipalID, Name, "UserAccount", Password))
{
if (asAdmin)
{
IAgentInfo agent = DataPlugins.RequestPlugin<IAgentConnector>().GetAgent(account.PrincipalID);
if (agent.OtherAgentInformation["WebUIEnabled"].AsBoolean() == false)
{
return resp;
}
}
resp["UUID"] = OSD.FromUUID (account.PrincipalID);
resp["FirstName"] = OSD.FromString (account.FirstName);
resp["LastName"] = OSD.FromString (account.LastName);
resp["Email"] = OSD.FromString(account.Email);
Verified = true;
}
resp["Verified"] = OSD.FromBoolean (Verified);
return resp;
}