39 std::span<ChatCommandBuilder const>
GetCommands()
const override
54 {
"lock", accountLockCommandTable },
55 {
"set", accountSetCommandTable },
63 {
"bnetaccount", accountCommandTable },
72 if (accountName.find(
'@') == std::string::npos)
79 std::string gameAccountName;
84 if (createGameAccount !=
false)
91 TC_LOG_INFO(
"entities.player.character",
"Account: {} (IP: {}) Character:[{}] ({}) created Battle.net account {}{}{}",
94 accountName, createGameAccount !=
false ?
" with game account " :
"", createGameAccount !=
false ? gameAccountName.c_str() :
"");
125 stmt->
setString(0, location->CountryCode);
133 TC_LOG_DEBUG(
"server.bnetserver",
"IP2Location] No information");
176 TC_LOG_INFO(
"entities.player.character",
"Battle.net account: {} (IP: {}) Character:[{}] ({}) Tried to change password, but the provided old password is wrong.",
183 if (newPassword != passwordConfirmation)
196 TC_LOG_INFO(
"entities.player.character",
"Battle.net account: {} (IP: {}) Character:[{}] ({}) Changed Password.",
224 if (!targetAccountId)
231 if (password != passwordConfirmation)
313 std::string accountName = std::to_string(accountId) +
'#' + std::to_string(
uint32(index));
316 std::array<uint8, 8> randPassword = Trinity::Crypto::GetRandomBytes<8>();
324 TC_LOG_INFO(
"entities.player.character",
"Account: {} (IP: {}) Character:[{}] ({}) created Account {} (Email: '{}')",
327 accountName, bnetAccountName);
358 stmt->
setString(0, battlenetAccountName);
361 auto formatDisplayName = [](
char const* name) -> std::string
363 if (
char const* hashPos = strchr(name,
'#'))
364 return std::string(
"WoW") + ++hashPos;
369 handler->
SendSysMessage(
"----------------------------------------------------");
371 handler->
SendSysMessage(
"----------------------------------------------------");
374 Field* fields = accountList->Fetch();
375 handler->
PSendSysMessage(
"| %10u | %-16.16s | %-16.16s |", fields[0].GetUInt32(), fields[1].
GetCString(), formatDisplayName(fields[1].GetCString()).c_str());
376 }
while (accountList->NextRow());
377 handler->
SendSysMessage(
"----------------------------------------------------");
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
@ LANG_ACCOUNT_ALREADY_EXIST
@ LANG_ACCOUNT_CREATED_BNET
@ LANG_COMMAND_NOTCHANGEPASSWORD
@ LANG_COMMAND_ACCLOCKLOCKED
@ LANG_ACCOUNT_PASS_TOO_LONG
@ LANG_ACCOUNT_OR_BNET_DOES_NOT_EXIST
@ LANG_ACCOUNT_BNET_NOT_LINKED
@ LANG_ACCOUNT_BNET_LIST_HEADER
@ LANG_COMMAND_WRONGOLDPASSWORD
@ LANG_ACCOUNT_ALREADY_LINKED
@ LANG_ACCOUNT_CREATED_BNET_WITH_GAME
@ LANG_COMMAND_ACCLOCKUNLOCKED
@ LANG_ACCOUNT_BNET_LIST_NO_ACCOUNTS
@ LANG_ACCOUNT_BNET_LINKED
@ LANG_ACCOUNT_NOT_CREATED_SQL_ERROR
@ LANG_ACCOUNT_NOT_CREATED
@ LANG_ACCOUNT_INVALID_BNET_NAME
@ LANG_ACCOUNT_BNET_UNLINKED
@ LANG_NEW_PASSWORDS_NOT_MATCH
@ LANG_ACCOUNT_NAME_TOO_LONG
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_INFO(filterType__, message__,...)
@ LOGIN_UPD_BNET_ACCOUNT_LOCK
@ LOGIN_SEL_BNET_GAME_ACCOUNT_LIST_SMALL
@ LOGIN_UPD_BNET_ACCOUNT_LOCK_CONTRY
std::optional< T > Optional
Optional helper class to wrap optional values within.
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
std::string ByteArrayToHexStr(Container const &c, bool reverse=false)
ObjectGuid const & GetGUID() const
WorldSession * GetSession()
void SetSentErrorMessage(bool val)
void PSendSysMessage(char const *fmt, Args &&... args)
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Class used to access individual fields of database query result.
char const * GetCString() const noexcept
std::string ToString() const
void setString(uint8 index, std::string &&value)
void setUInt32(uint8 index, uint32 value)
void setBool(uint8 index, bool value)
std::string const & GetName() const
Player * GetPlayer() const
std::string const & GetRemoteAddress() const
uint32 GetBattlenetAccountId() const
uint32 GetAccountId() const
battlenet_account_commandscript()
static bool HandleAccountPasswordCommand(ChatHandler *handler, std::string const &oldPassword, std::string const &newPassword, std::string const &passwordConfirmation)
static bool HandleAccountLockIpCommand(ChatHandler *handler, bool state)
std::span< ChatCommandBuilder const > GetCommands() const override
static bool HandleListGameAccountsCommand(ChatHandler *handler, std::string const &battlenetAccountName)
static bool HandleAccountSetPasswordCommand(ChatHandler *handler, std::string accountName, std::string const &password, std::string const &passwordConfirmation)
Set password for account.
static bool HandleAccountLockCountryCommand(ChatHandler *handler, bool state)
static bool HandleAccountLinkCommand(ChatHandler *handler, std::string const &bnetAccountName, std::string const &gameAccountName)
static bool HandleAccountCreateCommand(ChatHandler *handler, std::string const &accountName, std::string const &password, Optional< bool > createGameAccount)
Create an account.
static bool HandleAccountUnlinkCommand(ChatHandler *handler, std::string const &gameAccountName)
static bool HandleGameAccountCreateCommand(ChatHandler *handler, std::string const &bnetAccountName)
void AddSC_battlenet_account_commandscript()
TC_GAME_API AccountOpResult LinkWithGameAccount(std::string_view email, std::string_view gameAccountName)
TC_GAME_API AccountOpResult ChangePassword(uint32 accountId, std::string newPassword)
TC_GAME_API uint8 GetMaxIndex(uint32 accountId)
TC_GAME_API AccountOpResult CreateBattlenetAccount(std::string email, std::string password, bool withGameAccount, std::string *gameAccountName)
TC_GAME_API uint32 GetId(std::string_view username)
TC_GAME_API bool CheckPassword(uint32 accountId, std::string password)
TC_GAME_API AccountOpResult UnlinkGameAccount(std::string_view gameAccountName)
ChatCommandBuilder const [] ChatCommandTable
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_LOCK_COUNTRY
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_SET_PASSWORD
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_LIST_GAME_ACCOUTNS
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_PASSWORD
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_LOCK_IP
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_CREATE
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_CREATE_GAME
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_LINK
@ RBAC_PERM_COMMAND_BNET_ACCOUNT_UNLINK