Holy crap auth works (#2099)

* Holy crap auth works

* Fix some usages of UserID instead of UserName

* Refactor preferences.

They be non-async now. Also faster.

* Rename DbContext.

* Guest username assignment.

* Fix saving of profiles.

* Don't store data for guests.

* Fix generating invalid random colors.

* Don't allow dumb garbage for char preferences.

* Bans.

* Lol forgot to fill out the command description.

* Connection log.

* Rename all the tables and columns to be snake_case.

* Re-do migrations.

* Fixing tests and warnings.

* Update submodule
This commit is contained in:
Pieter-Jan Briers
2020-09-29 14:26:00 +02:00
committed by GitHub
parent 8a33e0a9bd
commit 66c8a68891
72 changed files with 4144 additions and 2642 deletions

View File

@@ -22,6 +22,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -144,7 +145,7 @@ namespace Content.Server.GameObjects.Components.Medical
UserInterface?.Open(actor.playerSession);
}
private async void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
{
if (!(obj.Message is CloningPodUiButtonPressedMessage message)) return;
@@ -167,11 +168,10 @@ namespace Content.Server.GameObjects.Components.Medical
var mob = _entityManager.SpawnEntity("HumanMob_Content", Owner.Transform.MapPosition);
var client = _playerManager
.GetPlayersBy(x => x.SessionId == mind.SessionId).First();
mob.GetComponent<HumanoidAppearanceComponent>()
.UpdateFromProfile(GetPlayerProfileAsync(client.Name).Result);
mob.Name = GetPlayerProfileAsync(client.Name).Result.Name;
var client = _playerManager.GetSessionByUserId(mind.UserId!.Value);
var profile = GetPlayerProfileAsync(client.UserId);
mob.GetComponent<HumanoidAppearanceComponent>().UpdateFromProfile(profile);
mob.Name = profile.Name;
_bodyContainer.Insert(mob);
_capturedMind = mind;
@@ -209,10 +209,9 @@ namespace Content.Server.GameObjects.Components.Medical
}
private async Task<HumanoidCharacterProfile> GetPlayerProfileAsync(string username)
private HumanoidCharacterProfile GetPlayerProfileAsync(NetUserId userId)
{
return (HumanoidCharacterProfile) (await _prefsManager.GetPreferencesAsync(username))
.SelectedCharacter;
return (HumanoidCharacterProfile) _prefsManager.GetPreferences(userId).SelectedCharacter;
}
private void HandleGhostReturn(GhostComponent.GhostReturnMessage message)