add: authentication failure handling and ingame error messages

This commit is contained in:
Matthew Toro 2026-04-04 19:56:53 -04:00
parent 14afabda0e
commit f238e682b3
13 changed files with 61 additions and 6 deletions

View file

@ -125,7 +125,8 @@ void PendingConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
return;
}
// printf("Server: handlePreLogin\n");
name = packet->loginKey; // 4J Stu - Change from the login packet as we know better on client end during the pre-login packet
if (!authComplete)
name = packet->loginKey;
sendPreLoginResponse();
}
@ -411,9 +412,10 @@ bool PendingConnection::isDisconnected()
void PendingConnection::initAuth()
{
handshakeManager = new HandshakeManager(true);
handshakeManager->registerModule(new SessionAuthModule());
handshakeManager->registerModule(new KeypairOfflineAuthModule());
handshakeManager->registerModule(new OfflineAuthModule());
if (server->authMode == "session")
handshakeManager->registerModule(new SessionAuthModule());
else
handshakeManager->registerModule(new OfflineAuthModule());
}
void PendingConnection::handleAuth(const shared_ptr<AuthPacket> &packet)
@ -433,6 +435,6 @@ void PendingConnection::handleAuth(const shared_ptr<AuthPacket> &packet)
}
else if (handshakeManager->isFailed())
{
disconnect(DisconnectPacket::eDisconnect_Closed);
disconnect(DisconnectPacket::eDisconnect_AuthFailed);
}
}