55 {
"lock", accountLockCommandTable },
56 {
"set", accountSetCommandTable },
64 {
"bnetaccount", accountCommandTable },
73 if (accountName.find(
'@') == std::string::npos)
80 std::string gameAccountName;
85 if (createGameAccount !=
false)
92 TC_LOG_INFO(
"entities.player.character",
"Account: {} (IP: {}) Character:[{}] ({}) created Battle.net account {}{}{}",
95 accountName, createGameAccount !=
false ?
" with game account " :
"", createGameAccount !=
false ? gameAccountName.c_str() :
"");
126 stmt->
setString(0, location->CountryCode);
134 TC_LOG_DEBUG(
"server.bnetserver",
"IP2Location] No information");
177 TC_LOG_INFO(
"entities.player.character",
"Battle.net account: {} (IP: {}) Character:[{}] ({}) Tried to change password, but the provided old password is wrong.",
184 if (newPassword != passwordConfirmation)
197 TC_LOG_INFO(
"entities.player.character",
"Battle.net account: {} (IP: {}) Character:[{}] ({}) Changed Password.",
225 if (!targetAccountId)
232 if (password != passwordConfirmation)
314 std::string accountName = std::to_string(accountId) +
'#' + std::to_string(
uint32(index));
317 std::array<uint8, 8> randPassword = Trinity::Crypto::GetRandomBytes<8>();
325 TC_LOG_INFO(
"entities.player.character",
"Account: {} (IP: {}) Character:[{}] ({}) created Account {} (Email: '{}')",
328 accountName, bnetAccountName);
362 auto formatDisplayName = [](
char const* name) -> std::string
364 if (
char const* hashPos = strchr(name,
'#'))
365 return std::string(
"WoW") + ++hashPos;
370 handler->
SendSysMessage(
"----------------------------------------------------");
372 handler->
SendSysMessage(
"----------------------------------------------------");
375 Field* fields = accountList->Fetch();
376 handler->
PSendSysMessage(
"| %10u | %-16.16s | %-16.16s |", fields[0].GetUInt32(), fields[1].
GetCString(), formatDisplayName(fields[1].GetCString()).c_str());
377 }
while (accountList->NextRow());
378 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__,...)
#define TC_LOG_INFO(filterType__,...)
@ 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)
WorldSession * GetSession()
void PSendSysMessage(const char *fmt, Args &&... args)
void SetSentErrorMessage(bool val)
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Class used to access individual fields of database query result.
char const * GetCString() const
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
void setStringView(const uint8 index, const std::string_view value)
void setBool(const uint8 index, const bool value)
void setUInt32(const uint8 index, const uint32 value)
void setString(const uint8 index, const std::string &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)
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.
ChatCommandTable GetCommands() const override
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)
std::vector< ChatCommandBuilder > 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