Core/Auth: Add option to extend account name limit to 64 characters
Closes #31903 (cherry picked from commit e185b2f98c42abe7805ea2c70c8cad4d60aaf781)
This commit is contained in:
@@ -24,7 +24,7 @@ DROP TABLE IF EXISTS `account`;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `account` (
|
||||
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier',
|
||||
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`salt` binary(32) NOT NULL,
|
||||
`verifier` binary(32) NOT NULL,
|
||||
`session_key_auth` binary(40) DEFAULT NULL,
|
||||
@@ -4436,6 +4436,7 @@ INSERT INTO `updates` VALUES
|
||||
('2026_09_02_00_auth.sql','3C13B03ECA470F80DA97991678074B95BCA3B03A','ARCHIVED','2026-09-02 10:05:00',0),
|
||||
('2026_09_09_00_auth.sql','CA28AF19AF741520683121E332ADAB74EB1E8A25','ARCHIVED','2026-09-09 08:23:05',0),
|
||||
('2026_09_12_00_auth.sql','FF363F9CB0CC1116A2122C5D258C3A625174E516','RELEASED','2026-09-12 22:05:06',0),
|
||||
('2026_09_14_00_auth.sql','6A6C23E6373F02200883FCA702D152BF73DA4E5F','RELEASED','2026-09-14 16:54:36',0),
|
||||
('2026_09_19_00_auth.sql','FEC4B9E3FEA7B198D3F70836F50B8A36035603C6','RELEASED','2026-09-19 00:21:00',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE `account` MODIFY COLUMN `username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' AFTER `id`;
|
||||
@@ -0,0 +1,11 @@
|
||||
UPDATE `trinity_string` SET
|
||||
`content_default`=REPLACE(`content_default`,'16','%u'),
|
||||
`content_loc1`=REPLACE(`content_loc1`,'16','%u'),
|
||||
`content_loc2`=REPLACE(`content_loc2`,'16','%u'),
|
||||
`content_loc3`=REPLACE(`content_loc3`,'16','%u'),
|
||||
`content_loc4`=REPLACE(`content_loc4`,'16','%u'),
|
||||
`content_loc5`=REPLACE(`content_loc5`,'16','%u'),
|
||||
`content_loc6`=REPLACE(`content_loc6`,'16','%u'),
|
||||
`content_loc7`=REPLACE(`content_loc7`,'16','%u'),
|
||||
`content_loc8`=REPLACE(`content_loc8`,'16','%u')
|
||||
WHERE `entry`=1005;
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -617,6 +617,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
{ .Name = "AllowTwoSide.Interaction.Guild"sv, .DefaultValue = false, .Index = CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD },
|
||||
{ .Name = "AllowTwoSide.Interaction.Auction"sv, .DefaultValue = true, .Index = CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION },
|
||||
{ .Name = "AllowTwoSide.Trade"sv, .DefaultValue = false, .Index = CONFIG_ALLOW_TWO_SIDE_TRADE },
|
||||
{ .Name = "ExtendedAccountNameLengthLimit"sv, .DefaultValue = false, .Index = CONFIG_EXTENDED_ACCOUNT_NAME_LENGTH_LIMIT },
|
||||
{ .Name = "CharacterCreating.DisableAlliedRaceAchievementRequirement"sv, .DefaultValue = false, .Index = CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT },
|
||||
{ .Name = "AllFlightPaths"sv, .DefaultValue = false, .Index = CONFIG_ALL_TAXI_PATHS },
|
||||
{ .Name = "InstantFlightPaths"sv, .DefaultValue = false, .Index = CONFIG_INSTANT_TAXI },
|
||||
|
||||
@@ -194,6 +194,7 @@ enum WorldBoolConfigs : uint32
|
||||
CONFIG_RESPAWN_DYNAMIC_ESCORTNPC,
|
||||
CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID,
|
||||
CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE,
|
||||
CONFIG_EXTENDED_ACCOUNT_NAME_LENGTH_LIMIT,
|
||||
CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT,
|
||||
CONFIG_BATTLEGROUNDMAP_LOAD_GRIDS,
|
||||
CONFIG_ENABLE_AE_LOOT,
|
||||
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
}
|
||||
break;
|
||||
case AccountOpResult::AOR_NAME_TOO_LONG:
|
||||
handler->SendSysMessage(LANG_ACCOUNT_NAME_TOO_LONG);
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NAME_TOO_LONG, MAX_ACCOUNT_STR[sWorld->getBoolConfig(CONFIG_EXTENDED_ACCOUNT_NAME_LENGTH_LIMIT)]);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
case AccountOpResult::AOR_PASS_TOO_LONG:
|
||||
|
||||
@@ -630,6 +630,13 @@ GameType = 0
|
||||
|
||||
RealmZone = 1
|
||||
|
||||
#
|
||||
# ExtendedAccountNameLengthLimit
|
||||
# Description: Extends account name limit from 16 (retail-like) to 64 characters
|
||||
# Default 0
|
||||
|
||||
ExtendedAccountNameLengthLimit = 0
|
||||
|
||||
#
|
||||
# StrictPlayerNames
|
||||
# Description: Limit player name to language specific symbol set. Prevents character
|
||||
|
||||
Reference in New Issue
Block a user