aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorForesterDev <forester.manv@gmail.com>2016-08-11 13:32:52 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-12 14:06:35 +0100
commit9d5304fd4f9824c1beb640ae96bf0513d26926ff (patch)
tree4bf9c6bad1e25ea7ad2556e585cf5b6c9de629bb /src
parentbf896fe2b05e8a6492252db1b190014d1ef611ce (diff)
Core/Command: Check account password max length
(cherry picked from commit fdcea5c7efd58c929e5d653af955f524dc543034) Rename 2016_08_04_05_world.sql to 2016_08_11_00_world.sql (cherry picked from commit d4f2f5968aadc5145e9a8c58dc7a4e0bd48c87e8)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp3
-rw-r--r--src/server/game/Accounts/BattlenetAccountMgr.cpp2
-rw-r--r--src/server/game/Miscellaneous/Language.h2
-rw-r--r--src/server/scripts/Commands/cs_account.cpp6
-rw-r--r--src/server/scripts/Commands/cs_battlenet_account.cpp16
5 files changed, 20 insertions, 9 deletions
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 9b136c34eb7..690b4c3f351 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -44,6 +44,9 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
if (utf8length(username) > MAX_ACCOUNT_STR)
return AccountOpResult::AOR_NAME_TOO_LONG; // username's too long
+ if (utf8length(password) > MAX_PASS_STR)
+ return AccountOpResult::AOR_PASS_TOO_LONG; // password's too long
+
Utf8ToUpperOnlyLatin(username);
Utf8ToUpperOnlyLatin(password);
Utf8ToUpperOnlyLatin(email);
diff --git a/src/server/game/Accounts/BattlenetAccountMgr.cpp b/src/server/game/Accounts/BattlenetAccountMgr.cpp
index d304c30d9cc..3909de055e7 100644
--- a/src/server/game/Accounts/BattlenetAccountMgr.cpp
+++ b/src/server/game/Accounts/BattlenetAccountMgr.cpp
@@ -35,7 +35,7 @@ AccountOpResult Battlenet::AccountMgr::CreateBattlenetAccount(std::string email,
Utf8ToUpperOnlyLatin(password);
if (GetId(email))
- return AccountOpResult::AOR_NAME_ALREADY_EXIST;
+ return AccountOpResult::AOR_NAME_ALREADY_EXIST;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_BNET_ACCOUNT);
stmt->setString(0, email);
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index 148d7affc63..1317373b2f9 100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -873,7 +873,7 @@ enum TrinityStrings
LANG_ACCOUNT_NOT_DELETED_SQL_ERROR = 1002,
LANG_ACCOUNT_NOT_DELETED = 1003,
LANG_ACCOUNT_CREATED = 1004,
- LANG_ACCOUNT_TOO_LONG = 1005,
+ LANG_ACCOUNT_NAME_TOO_LONG = 1005,
LANG_ACCOUNT_ALREADY_EXIST = 1006,
LANG_ACCOUNT_NOT_CREATED_SQL_ERROR = 1007,
LANG_ACCOUNT_NOT_CREATED = 1008,
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 40278cb856e..72c571ae007 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -141,7 +141,11 @@ public:
}
break;
case AccountOpResult::AOR_NAME_TOO_LONG:
- handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
+ handler->SendSysMessage(LANG_ACCOUNT_NAME_TOO_LONG);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case AccountOpResult::AOR_PASS_TOO_LONG:
+ handler->SendSysMessage(LANG_ACCOUNT_PASS_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
case AccountOpResult::AOR_NAME_ALREADY_EXIST:
diff --git a/src/server/scripts/Commands/cs_battlenet_account.cpp b/src/server/scripts/Commands/cs_battlenet_account.cpp
index 3014d86ae34..5a19ef48dca 100644
--- a/src/server/scripts/Commands/cs_battlenet_account.cpp
+++ b/src/server/scripts/Commands/cs_battlenet_account.cpp
@@ -105,15 +105,15 @@ public:
break;
}
case AccountOpResult::AOR_NAME_TOO_LONG:
- handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
+ handler->SendSysMessage(LANG_ACCOUNT_NAME_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
- case AccountOpResult::AOR_NAME_ALREADY_EXIST:
- handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
+ case AccountOpResult::AOR_PASS_TOO_LONG:
+ handler->SendSysMessage(LANG_ACCOUNT_PASS_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
- case AccountOpResult::AOR_PASS_TOO_LONG:
- handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
+ case AccountOpResult::AOR_NAME_ALREADY_EXIST:
+ handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
handler->SetSentErrorMessage(true);
return false;
default:
@@ -442,7 +442,11 @@ public:
}
break;
case AccountOpResult::AOR_NAME_TOO_LONG:
- handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
+ handler->SendSysMessage(LANG_ACCOUNT_NAME_TOO_LONG);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case AccountOpResult::AOR_PASS_TOO_LONG:
+ handler->SendSysMessage(LANG_ACCOUNT_PASS_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
case AccountOpResult::AOR_NAME_ALREADY_EXIST: