27 static std::vector<ChatCommand> accountSetSecTable =
32 static std::vector<ChatCommand> accountSetCommandTable =
39 static std::vector<ChatCommand> accountLockCommandTable =
44 static std::vector<ChatCommand> accountBoostCommandTable =
49 static std::vector<ChatCommand> accountCommandTable =
61 static std::vector<ChatCommand> commandTable =
77 char* exp = strtok((
char*)args,
" ");
81 int expansion = atoi(exp);
109 char* accountName = strtok((
char*)args,
" ");
110 char* password = strtok(NULL,
" ");
111 char* possibleEmail = strtok(NULL,
" ' ");
113 email = possibleEmail;
115 if (!accountName || !password)
125 SF_LOG_INFO(
"entities.player.character",
"Account: %d (IP: %s) Character:[%s] (GUID: %u) created Account %s (Email: '%s')",
128 accountName, email.c_str());
160 char* account = strtok((
char*)args,
" ");
164 std::string accountName = account;
231 Field* fieldsDB = result->Fetch();
232 std::string name = fieldsDB[0].
GetString();
243 Field* fieldsLogin = resultLogin->Fetch();
245 fieldsLogin[0].GetCString(), name.c_str(), fieldsLogin[1].
GetCString(),
251 }
while (result->NextRow());
265 std::string param = (
char*)args;
278 Field* fields = result->Fetch();
279 std::string country = fields[0].
GetString();
289 SF_LOG_DEBUG(
"server.authserver",
"[IP2NATION] Table empty");
292 else if (param ==
"off")
316 std::string param = (
char*)args;
327 else if (param ==
"off")
353 char* oldEmail = strtok((
char*)args,
" ");
354 char* password = strtok(NULL,
" ");
355 char* email = strtok(NULL,
" ");
356 char* emailConfirmation = strtok(NULL,
" ");
358 if (!oldEmail || !password || !email || !emailConfirmation)
369 SF_LOG_INFO(
"entities.player.character",
"Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided email [%s] is not equal to registration email [%s].",
380 SF_LOG_INFO(
"entities.player.character",
"Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.",
386 if (strcmp(email, oldEmail) == 0)
393 if (strcmp(email, emailConfirmation) != 0)
397 SF_LOG_INFO(
"entities.player.character",
"Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.",
409 SF_LOG_INFO(
"entities.player.character",
"Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Email from [%s] to [%s].",
441 char* oldPassword = strtok((
char*)args,
" ");
442 char* newPassword = strtok(NULL,
" ");
443 char* passwordConfirmation = strtok(NULL,
" ");
444 char const* emailConfirmation = strtok(NULL,
" ");
445 if (!emailConfirmation)
446 emailConfirmation =
"";
449 if (!oldPassword || !newPassword || !passwordConfirmation)
461 SF_LOG_INFO(
"entities.player.character",
"Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the provided old password is wrong.",
473 SF_LOG_INFO(
"entities.player.character",
"Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the entered email [%s] is wrong.",
481 if (strcmp(newPassword, passwordConfirmation) != 0)
494 SF_LOG_INFO(
"entities.player.character",
"Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.",
522 pwConfig ==
PW_EMAIL ?
"Highest level: Email input required." :
523 pwConfig ==
PW_RBAC ?
"Special level: Your account may require email input depending on settings. That is the case if another lien is printed." :
524 "Unknown security level: Notify technician for details."));
533 std::string emailoutput;
542 emailoutput = (*result)[0].GetString();
554 char* account = strtok((
char*)args,
" ");
555 char* exp = strtok(NULL,
" ");
560 std::string accountName;
576 accountName = account;
599 int expansion = atoi(exp);
623 std::string targetAccountName;
624 uint32 targetAccountId = 0;
627 char* arg1 = strtok((
char*)args,
" ");
628 char* arg2 = strtok(NULL,
" ");
629 char* arg3 = strtok(NULL,
" ");
630 bool isAccountNameGiven =
true;
636 isAccountNameGiven =
false;
640 if (!isAccountNameGiven && !arg2)
644 if (isAccountNameGiven)
646 targetAccountName = arg1;
656 gm =
AccountTypes((isAccountNameGiven) ? atoi(arg2) : atoi(arg1));
666 int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
676 if (targetSecurity >= playerSecurity || gm >= playerSecurity)
727 char* account = strtok((
char*)args,
" ");
728 char* password = strtok(NULL,
" ");
729 char* passwordConfirmation = strtok(NULL,
" ");
731 if (!account || !password || !passwordConfirmation)
734 std::string accountName = account;
743 if (!targetAccountId)
755 if (strcmp(password, passwordConfirmation))
792 char* account = strtok((
char*)args,
" ");
793 char* email = strtok(NULL,
" ");
794 char* emailConfirmation = strtok(NULL,
" ");
796 if (!account || !email || !emailConfirmation)
803 std::string accountName = account;
812 if (!targetAccountId)
824 if (strcmp(email, emailConfirmation) != 0)
836 SF_LOG_INFO(
"entities.player.character",
"ChangeEmail: Account %s [Id: %u] had it's email changed to %s.",
837 accountName.c_str(), targetAccountId, email);
868 char* account = strtok((
char*)args,
" ");
869 char* email = strtok(NULL,
" ");
870 char* emailConfirmation = strtok(NULL,
" ");
872 if (!account || !email || !emailConfirmation)
879 std::string accountName = account;
888 if (!targetAccountId)
900 if (strcmp(email, emailConfirmation) != 0)
912 SF_LOG_INFO(
"entities.player.character",
"ChangeRegEmail: Account %s [Id: %u] had it's Registration Email changed to %s.",
913 accountName.c_str(), targetAccountId, email);
938 char* account = strtok((
char*)args,
" ");
942 std::string accountName = account;
989 char* account = strtok((
char*)args,
" ");
993 std::string accountName = account;
void EndianConvertReverse(T &val)
@ CHAR_SEL_CHARACTER_ONLINE
@ LANG_ACCOUNT_ALREADY_EXIST
@ LANG_ACCOUNT_LIST_ERROR
@ LANG_COMMAND_NOTCHANGEPASSWORD
@ LANG_COMMAND_ACCLOCKLOCKED
@ LANG_COMMAND_EMAIL_OUTPUT
@ LANG_ACCOUNT_LIST_EMPTY
@ LANG_YOU_CHANGE_SECURITY
@ LANG_COMMAND_WRONGOLDPASSWORD
@ LANG_ACCOUNT_NOT_DELETED_SQL_ERROR
@ LANG_ACCOUNT_LIST_HEADER
@ LANG_COMMAND_WRONGEMAIL
@ LANG_COMMAND_ACCLOCKUNLOCKED
@ LANG_NEW_EMAILS_NOT_MATCH
@ LANG_ACCOUNT_NOT_CREATED_SQL_ERROR
@ LANG_ACCOUNT_NOT_CREATED
@ LANG_COMMAND_NOTCHANGEEMAIL
@ LANG_YOURS_SECURITY_IS_LOW
@ LANG_NEW_PASSWORDS_NOT_MATCH
@ LANG_OLD_EMAIL_IS_NEW_EMAIL
@ LANG_ACCOUNT_LIST_BAR_HEADER
@ LANG_ACCOUNT_NOT_DELETED
@ LANG_RBAC_EMAIL_REQUIRED
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_INFO(filterType__,...)
@ LOGIN_SEL_ACCOUNT_BY_ID
@ LOGIN_UPD_ACCOUNT_BOOST
@ LOGIN_SEL_LOGON_COUNTRY
@ LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST
@ LOGIN_UPD_ACCOUNT_LOCK_CONTRY
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
static AccountOpResult ChangeRegEmail(uint32 accountId, std::string newEmail)
static AccountOpResult DeleteAccount(uint32 accountId)
static bool CheckPassword(uint32 accountId, std::string password)
static AccountOpResult ChangeEmail(uint32 accountId, std::string newEmail)
static AccountTypes GetSecurity(uint32 accountId)
static AccountOpResult ChangePassword(uint32 accountId, std::string newPassword)
static bool normalizeString(std::string &utf8String)
static uint32 GetId(std::string const &username)
static bool IsConsoleAccount(AccountTypes gmlevel)
static bool CheckEmail(uint32 accountId, std::string newEmail)
static bool GetName(uint32 accountId, std::string &name)
Player * getSelectedPlayer()
WorldSession * GetSession()
virtual bool HasPermission(uint32 permission) const
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
void SetSentErrorMessage(bool val)
virtual void SendSysMessage(const char *str)
bool HasLowerSecurityAccount(WorldSession *target, uint32 account, bool strong=false)
CommandScript(const char *name)
std::string GetString() const
char const * GetCString() const
uint32 GetGUIDLow() const
WorldSession * GetSession() const
void setBool(const uint8 index, const bool value)
void setString(const uint8 index, const std::string &value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt8(const uint8 index, const uint8 value)
std::string const & GetName() const
AccountTypes GetSecurity() const
Player * GetPlayer() const
uint32 GetAccountId() const
std::string const & GetRemoteAddress()
rbac::RBACData * GetRBACData()
static bool HandleAccountLockIpCommand(ChatHandler *handler, char const *args)
static bool HandleAccountSetGmLevelCommand(ChatHandler *handler, char const *args)
static bool HandleAccountBoostDelCommand(ChatHandler *handler, char const *args)
static bool HandleAccountSetRegEmailCommand(ChatHandler *handler, char const *args)
Change registration email for account.
static bool HandleAccountLockCountryCommand(ChatHandler *handler, char const *args)
static bool HandleAccountOnlineListCommand(ChatHandler *handler, char const *)
Display info on users currently in the realm.
static bool HandleAccountEmailCommand(ChatHandler *handler, char const *args)
static bool HandleAccountDeleteCommand(ChatHandler *handler, char const *args)
static bool HandleAccountSetEmailCommand(ChatHandler *handler, char const *args)
Set normal email for account.
static bool HandleAccountPasswordCommand(ChatHandler *handler, char const *args)
static bool HandleAccountSetPasswordCommand(ChatHandler *handler, char const *args)
Set password for account.
static bool HandleAccountBoostAddCommand(ChatHandler *handler, char const *args)
static bool HandleAccountAddonCommand(ChatHandler *handler, char const *args)
static bool HandleAccountSetAddonCommand(ChatHandler *handler, char const *args)
Set/Unset the expansion level for an account.
static bool HandleAccountCommand(ChatHandler *handler, char const *)
static bool HandleAccountCreateCommand(ChatHandler *handler, char const *args)
Create an account.
std::vector< ChatCommand > GetCommands() const OVERRIDE
void AddSC_account_commandscript()
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
@ CONFIG_ACC_PASSCHANGESEC
uint32 ToIPv4NetworkOrder(std::string const &host)
@ RBAC_PERM_MAY_CHECK_OWN_EMAIL
@ RBAC_PERM_COMMAND_ACCOUNT_DELETE
@ RBAC_PERM_COMMAND_ACCOUNT_SET_ADDON
@ RBAC_PERM_COMMAND_ACCOUNT_SET
@ RBAC_PERM_COMMAND_ACCOUNT_BOOST
@ RBAC_PERM_COMMAND_ACCOUNT_BOOST_ADD
@ RBAC_PERM_COMMAND_ACCOUNT_ADDON
@ RBAC_PERM_COMMAND_ACCOUNT_ONLINE_LIST
@ RBAC_PERM_COMMAND_ACCOUNT
@ RBAC_PERM_COMMAND_ACCOUNT_BOOST_DEL
@ RBAC_PERM_COMMAND_ACCOUNT_CREATE
@ RBAC_PERM_COMMAND_ACCOUNT_SET_SEC_EMAIL
@ RBAC_PERM_COMMAND_ACCOUNT_EMAIL
@ RBAC_PERM_COMMAND_ACCOUNT_SET_GMLEVEL
@ RBAC_PERM_COMMAND_ACCOUNT_PASSWORD
@ RBAC_PERM_COMMAND_ACCOUNT_SET_SEC
@ RBAC_PERM_COMMAND_ACCOUNT_LOCK_COUNTRY
@ RBAC_PERM_COMMAND_ACCOUNT_LOCK_IP
@ RBAC_PERM_COMMAND_ACCOUNT_SET_PASSWORD
@ RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE
@ RBAC_PERM_COMMAND_ACCOUNT_SET_SEC_REGMAIL
@ RBAC_PERM_COMMAND_ACCOUNT_LOCK
LoginDatabaseWorkerPool LoginDatabase