mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
feat(Core/Network): Add conf to allow/disallow storing IP address (#7168)
* feat(Core/Network): Add conf to allow/disallow storing the IP address
* cherry-pick commit (68bf7e6d12)
Co-Authored-By: Giacomo Pozzoni <giacomopoz@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "WorldSocket.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "BigNumber.h"
|
||||
#include "Config.h"
|
||||
#include "CryptoHash.h"
|
||||
#include "CryptoRandom.h"
|
||||
#include "DatabaseEnv.h"
|
||||
@@ -452,10 +453,12 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
|
||||
AccountInfo account(result->Fetch());
|
||||
|
||||
// For hook purposes, we get Remoteaddress at this point.
|
||||
std::string address = GetRemoteIpAddress().to_string();
|
||||
std::string address = sConfigMgr->GetOption<bool>("AllowLoggingIPAddressesInDatabase", true, true) ? GetRemoteIpAddress().to_string() : "0.0.0.0";
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = nullptr;
|
||||
|
||||
// As we don't know if attempted login process by ip works, we update last_attempt_ip right away
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP);
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_LAST_ATTEMPT_IP);
|
||||
stmt->setString(0, address);
|
||||
stmt->setString(1, authSession->Account);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
Reference in New Issue
Block a user