wip
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ALTER TABLE `account` MODIFY COLUMN `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' AFTER `id`;
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "SRP6.h"
|
||||
#include "Util.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
using AccountSRP6 = Trinity::Crypto::SRP::GruntSRP6;
|
||||
@@ -45,7 +46,7 @@ AccountMgr* AccountMgr::instance()
|
||||
|
||||
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password, std::string email /*= ""*/, uint32 bnetAccountId /*= 0*/, uint8 bnetIndex /*= 0*/)
|
||||
{
|
||||
if (utf8length(username) > MAX_ACCOUNT_STR)
|
||||
if (utf8length(username) > MAX_ACCOUNT_STR[sWorld->getBoolConfig(CONFIG_EXTENDED_ACCOUNT_NAME_LENGTH_LIMIT)] || username.length() > MAX_ACCOUNT_NAME_BYTES)
|
||||
return AccountOpResult::AOR_NAME_TOO_LONG; // username's too long
|
||||
|
||||
if (utf8length(password) > MAX_PASS_STR)
|
||||
@@ -175,7 +176,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accountId, std::string newUser
|
||||
if (!result)
|
||||
return AccountOpResult::AOR_NAME_NOT_EXIST;
|
||||
|
||||
if (utf8length(newUsername) > MAX_ACCOUNT_STR)
|
||||
if (utf8length(newUsername) > MAX_ACCOUNT_STR[sWorld->getBoolConfig(CONFIG_EXTENDED_ACCOUNT_NAME_LENGTH_LIMIT)] || newUsername.length() > MAX_ACCOUNT_NAME_BYTES)
|
||||
return AccountOpResult::AOR_NAME_TOO_LONG;
|
||||
|
||||
if (utf8length(newPassword) > MAX_PASS_STR)
|
||||
|
||||
@@ -40,9 +40,10 @@ enum PasswordChangeSecurity
|
||||
PW_RBAC
|
||||
};
|
||||
|
||||
#define MAX_PASS_STR 16
|
||||
#define MAX_ACCOUNT_STR 16
|
||||
#define MAX_EMAIL_STR 64
|
||||
inline constexpr std::size_t MAX_ACCOUNT_STR[2] = { 16, 64 };
|
||||
inline constexpr std::size_t MAX_ACCOUNT_NAME_BYTES = 255;
|
||||
inline constexpr std::size_t MAX_PASS_STR = 16;
|
||||
inline constexpr std::size_t MAX_EMAIL_STR = 64;
|
||||
|
||||
namespace rbac
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user