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)
This commit is contained in:
ForesterDev
2017-02-12 14:06:35 +01:00
committed by joschiwald
parent bf896fe2b0
commit 9d5304fd4f
6 changed files with 23 additions and 9 deletions
@@ -0,0 +1,3 @@
DELETE FROM `trinity_string` WHERE `entry` = 1031;
INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES
(1031, 'An account password can NOT be longer than 16 characters (client limit). The account was NOT created.');
+3
View File
@@ -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);
@@ -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);
+1 -1
View File
@@ -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,
+5 -1
View File
@@ -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:
@@ -105,17 +105,17 @@ 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:
handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
handler->SetSentErrorMessage(true);
return false;
case AccountOpResult::AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
handler->SetSentErrorMessage(true);
return false;
default:
break;
}
@@ -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: