Skip to content

Commit

Permalink
Fix OTC login failing to create session (#4845)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturKnopik authored Nov 24, 2024
1 parent 14ba662 commit 33485a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/protocollogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ void ProtocolLogin::getCharacterList(const std::string& accountName, const std::
output->addByte(0x28);
output->addString(tfs::base64::encode({sessionKey.data(), sessionKey.size()}));

if (!db.executeQuery(fmt::format(
"INSERT INTO `sessions` (`token`, `account_id`, `ip`) VALUES ({:s}, {:d}, INET6_ATON({:s}))",
db.escapeBlob(sessionKey.data(), sessionKey.size()), id, getConnection()->getIP().to_string()))) {
if (!db.executeQuery(
fmt::format("INSERT INTO `sessions` (`token`, `account_id`, `ip`) VALUES ({:s}, {:d}, INET6_ATON({:s}))",
db.escapeBlob(sessionKey.data(), sessionKey.size()), id,
db.escapeString(getConnection()->getIP().to_string())))) {
disconnectClient("Failed to create session.\nPlease try again later.", version);
return;
}
Expand Down

0 comments on commit 33485a5

Please sign in to comment.