Wrong password hash size

main
Thomas Woischnig 2023-12-04 20:52:06 +01:00
parent 97f7dcb049
commit cee5a4cf4f
6 changed files with 34 additions and 5 deletions

View File

@ -428,6 +428,7 @@ namespace Lobbies
case LobbyHostInfo.TypeId: case LobbyHostInfo.TypeId:
{ {
var lobbyHostInfo = LobbyHostInfo.Deserialize(data.Span); var lobbyHostInfo = LobbyHostInfo.Deserialize(data.Span);
if (lobbyHostInfo != null) if (lobbyHostInfo != null)
{ {
events.Enqueue(new LobbyClientEvent { EventType = LobbyClientEventTypes.LobbyHostInfo, EventData = lobbyHostInfo }); events.Enqueue(new LobbyClientEvent { EventType = LobbyClientEventTypes.LobbyHostInfo, EventData = lobbyHostInfo });

View File

@ -29,6 +29,26 @@ _ = Task.Run(() =>
{ {
switch (lobbyEvent.EventType) switch (lobbyEvent.EventType)
{ {
case LobbyClientEventTypes.LobbyJoinFailed:
{
var lobbyJoinFailReason = lobbyEvent.EventData as LobbyJoinFailReason;
var p = Console.GetCursorPosition();
Console.SetCursorPosition(0, p.Top);
switch (lobbyJoinFailReason!.Reason)
{
case LobbyJoinFailReason.FailReasons.WrongPassword:
Console.WriteLine("Lobby password wrong!");
break;
case LobbyJoinFailReason.FailReasons.LobbyFull:
Console.WriteLine("Lobby full!");
break;
case LobbyJoinFailReason.FailReasons.LobbyNotFound:
Console.WriteLine("Lobby not found!");
break;
}
Console.Write(">");
}
break;
case LobbyClientEventTypes.Connected: case LobbyClientEventTypes.Connected:
{ {
connected = true; connected = true;
@ -210,7 +230,7 @@ while (running)
else else
{ {
Console.WriteLine("Hosting game ..."); Console.WriteLine("Hosting game ...");
lobbyClient.HostLobby(GameGuids.NFS, "Hallo, Welt!", 1, 8, null, myPort); lobbyClient.HostLobby(GameGuids.NFS, "Hallo, Welt!", 1, 8, "haher", myPort);
fakeGameHost.isHost = true; fakeGameHost.isHost = true;
} }
} }
@ -234,6 +254,14 @@ while (running)
var firstLobby = openLobbies.FirstOrDefault(); var firstLobby = openLobbies.FirstOrDefault();
if (firstLobby != null) if (firstLobby != null)
{ {
if(firstLobby.PasswordProtected)
{
Console.WriteLine("Please enter password: ");
Console.Write(">");
var password = Console.ReadLine();
lobbyClient.RequestLobbyHostInfo(firstLobby.Id, password);
}
else
lobbyClient.RequestLobbyHostInfo(firstLobby.Id, null); lobbyClient.RequestLobbyHostInfo(firstLobby.Id, null);
} }
else else

View File

@ -15,7 +15,7 @@ namespace LobbyServerDto
/// <summary> /// <summary>
/// Hash of the password if the lobby requires one /// Hash of the password if the lobby requires one
/// </summary> /// </summary>
[MaxLength(26)] [MaxLength(64)]
public byte[]? PasswordHash { get; set; } public byte[]? PasswordHash { get; set; }
} }
} }

View File

@ -15,7 +15,7 @@ namespace LobbyServerDto
/// <summary> /// <summary>
/// Password hash if the lobby is password protected /// Password hash if the lobby is password protected
/// </summary> /// </summary>
[MaxLength(26)] [MaxLength(64)]
public byte[]? PasswordHash { get; set; } public byte[]? PasswordHash { get; set; }
/// <summary> /// <summary>
/// Our external ip /// Our external ip