diff options
author | Shauren <shauren.trinity@gmail.com> | 2014-06-08 17:58:28 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2014-06-08 17:58:28 +0200 |
commit | 434b3a80e1ef4ccef3d66661e6a260b6328eabe5 (patch) | |
tree | ac51417a1fc3cc9a70be0109252d717961e4a191 /src/server/game/Accounts/BattlenetAccountMgr.cpp | |
parent | 7dd552c8261be9d1c9c8e45628e5aca5cdae405d (diff) |
Core/Commands: Added a set of commands to manage battle.net accounts
TODO: Ban commands, linking game accounts to battle.net accounts
Diffstat (limited to 'src/server/game/Accounts/BattlenetAccountMgr.cpp')
-rw-r--r-- | src/server/game/Accounts/BattlenetAccountMgr.cpp | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/server/game/Accounts/BattlenetAccountMgr.cpp b/src/server/game/Accounts/BattlenetAccountMgr.cpp index 8b73ba19a97..4f4d78591f9 100644 --- a/src/server/game/Accounts/BattlenetAccountMgr.cpp +++ b/src/server/game/Accounts/BattlenetAccountMgr.cpp @@ -23,9 +23,12 @@ AccountOpResult Battlenet::AccountMgr::CreateBattlenetAccount(std::string email, std::string password) { - if (utf8length(email) > 64) + if (utf8length(email) > MAX_BNET_EMAIL_STR) return AccountOpResult::AOR_NAME_TOO_LONG; + if (utf8length(password) > MAX_PASS_STR) + return AccountOpResult::AOR_PASS_TOO_LONG; + Utf8ToUpperOnlyLatin(email); Utf8ToUpperOnlyLatin(password); @@ -40,33 +43,6 @@ AccountOpResult Battlenet::AccountMgr::CreateBattlenetAccount(std::string email, return AccountOpResult::AOR_OK; } -AccountOpResult Battlenet::AccountMgr::ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) -{ - // Check if accounts exists - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_EMAIL_BY_ID); - stmt->setUInt32(0, accountId); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (!result) - return AccountOpResult::AOR_NAME_NOT_EXIST; - - Utf8ToUpperOnlyLatin(newUsername); - if (utf8length(newUsername) > MAX_ACCOUNT_STR) - return AccountOpResult::AOR_NAME_TOO_LONG; - - Utf8ToUpperOnlyLatin(newPassword); - if (utf8length(newPassword) > MAX_PASS_STR) - return AccountOpResult::AOR_PASS_TOO_LONG; - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_PASSWORD); - stmt->setString(0, newUsername); - stmt->setString(1, CalculateShaPassHash(newUsername, newPassword)); - stmt->setUInt32(2, accountId); - LoginDatabase.Execute(stmt); - - return AccountOpResult::AOR_OK; -} - AccountOpResult Battlenet::AccountMgr::ChangePassword(uint32 accountId, std::string newPassword) { std::string username; |