AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AccountInfo Struct Reference

#include "AuthSession.h"

Public Member Functions

void LoadResult (Field *fields)
 
 AccountInfo (Field *fields)
 

Public Attributes

uint32 Id = 0
 
std::string Login
 
bool IsLockedToIP = false
 
std::string LockCountry
 
std::string LastIP
 
uint32 FailedLogins = 0
 
bool IsBanned = false
 
bool IsPermanentlyBanned = false
 
AccountTypes SecurityLevel = SEC_PLAYER
 
::SessionKey SessionKey
 
uint8 Expansion
 
int64 MuteTime
 
LocaleConstant Locale
 
uint32 Recruiter
 
std::string OS
 
bool IsRectuiter
 
AccountTypes Security
 
uint32 TotalTime
 

Detailed Description

Constructor & Destructor Documentation

◆ AccountInfo()

AccountInfo::AccountInfo ( Field fields)
inlineexplicit
362 {
363 // 0 1 2 3 4 5 6 7 8 9 10 11
364 // SELECT a.id, a.sessionkey, a.last_ip, a.locked, a.lock_country, a.expansion, a.mutetime, a.locale, a.recruiter, a.os, a.totaltime, aa.gmLevel,
365 // 12 13
366 // ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id
367 // FROM account a
368 // LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?)
369 // LEFT JOIN account_banned ab ON a.id = ab.id
370 // LEFT JOIN account r ON a.id = r.recruiter
371 // WHERE a.username = ? ORDER BY aa.RealmID DESC LIMIT 1
372 Id = fields[0].Get<uint32>();
373 SessionKey = fields[1].Get<Binary, SESSION_KEY_LENGTH>();
374 LastIP = fields[2].Get<std::string>();
375 IsLockedToIP = fields[3].Get<bool>();
376 LockCountry = fields[4].Get<std::string>();
377 Expansion = fields[5].Get<uint8>();
378 MuteTime = fields[6].Get<int64>();
379 Locale = LocaleConstant(fields[7].Get<uint8>());
380 Recruiter = fields[8].Get<uint32>();
381 OS = fields[9].Get<std::string>();
382 TotalTime = fields[10].Get<uint32>();
383 Security = AccountTypes(fields[11].Get<uint8>());
384 IsBanned = fields[12].Get<uint64>() != 0;
385 IsRectuiter = fields[13].Get<uint32>() != 0;
386
387 uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
388 if (Expansion > world_expansion)
389 Expansion = world_expansion;
390
391 if (Locale >= TOTAL_LOCALES)
393 }
LocaleConstant
Definition: Common.h:65
@ TOTAL_LOCALES
Definition: Common.h:76
@ LOCALE_enUS
Definition: Common.h:66
AccountTypes
Definition: Common.h:56
std::array< uint8, SESSION_KEY_LENGTH > SessionKey
Definition: AuthDefines.h:25
constexpr std::size_t SESSION_KEY_LENGTH
Definition: AuthDefines.h:24
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
std::uint64_t uint64
Definition: Define.h:106
std::int64_t int64
Definition: Define.h:102
@ CONFIG_EXPANSION
Definition: IWorld.h:280
std::vector< uint8 > Binary
Definition: Field.h:41
#define sWorld
Definition: World.h:444
std::string LockCountry
Definition: AuthSession.h:56
std::string OS
Definition: WorldSocket.cpp:355
uint32 Recruiter
Definition: WorldSocket.cpp:354
LocaleConstant Locale
Definition: WorldSocket.cpp:353
int64 MuteTime
Definition: WorldSocket.cpp:352
bool IsRectuiter
Definition: WorldSocket.cpp:356
AccountTypes Security
Definition: WorldSocket.cpp:357
uint32 Id
Definition: AuthSession.h:53
bool IsBanned
Definition: AuthSession.h:59
bool IsLockedToIP
Definition: AuthSession.h:55
std::string LastIP
Definition: AuthSession.h:57
uint8 Expansion
Definition: WorldSocket.cpp:351
uint32 TotalTime
Definition: WorldSocket.cpp:359
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113

References CONFIG_EXPANSION, Expansion, Field::Get(), Id, IsBanned, IsLockedToIP, IsRectuiter, LastIP, Locale, LOCALE_enUS, LockCountry, MuteTime, OS, Recruiter, Security, SESSION_KEY_LENGTH, sWorld, TOTAL_LOCALES, and TotalTime.

Member Function Documentation

◆ LoadResult()

void AccountInfo::LoadResult ( Field fields)
139{
140 // 0 1 2 3 4 5
141 // SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins,
142 // 6 7
143 // ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate,
144 // 8 9
145 // ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate,
146 // 10
147 // aa.gmlevel (, more query-specific fields)
148 // FROM account a LEFT JOIN account_access aa ON a.id = aa.id LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 LEFT JOIN ip_banned ipb ON ipb.ip = ? WHERE a.username = ?
149
150 Id = fields[0].Get<uint32>();
151 Login = fields[1].Get<std::string>();
152 IsLockedToIP = fields[2].Get<bool>();
153 LockCountry = fields[3].Get<std::string>();
154 LastIP = fields[4].Get<std::string>();
155 FailedLogins = fields[5].Get<uint32>();
156 IsBanned = fields[6].Get<bool>() || fields[8].Get<bool>();
157 IsPermanentlyBanned = fields[7].Get<bool>() || fields[9].Get<bool>();
158 SecurityLevel = static_cast<AccountTypes>(fields[10].Get<uint8>()) > SEC_CONSOLE ? SEC_CONSOLE : static_cast<AccountTypes>(fields[10].Get<uint8>());
159
160 // Use our own uppercasing of the account name instead of using UPPER() in mysql query
161 // This is how the account was created in the first place and changing it now would result in breaking
162 // login for all accounts having accented characters in their name
164}
@ SEC_CONSOLE
Definition: Common.h:61
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition: Util.cpp:532
uint32 FailedLogins
Definition: AuthSession.h:58
bool IsPermanentlyBanned
Definition: AuthSession.h:60
AccountTypes SecurityLevel
Definition: AuthSession.h:61
std::string Login
Definition: AuthSession.h:54

References FailedLogins, Field::Get(), Id, IsBanned, IsLockedToIP, IsPermanentlyBanned, LastIP, LockCountry, Login, SEC_CONSOLE, SecurityLevel, and Utf8ToUpperOnlyLatin().

Referenced by AuthSession::LogonChallengeCallback(), and AuthSession::ReconnectChallengeCallback().

Member Data Documentation

◆ Expansion

uint8 AccountInfo::Expansion

◆ FailedLogins

uint32 AccountInfo::FailedLogins = 0

◆ Id

◆ IsBanned

◆ IsLockedToIP

◆ IsPermanentlyBanned

bool AccountInfo::IsPermanentlyBanned = false

◆ IsRectuiter

bool AccountInfo::IsRectuiter

◆ LastIP

◆ Locale

◆ LockCountry

◆ Login

◆ MuteTime

int64 AccountInfo::MuteTime

◆ OS

std::string AccountInfo::OS

◆ Recruiter

uint32 AccountInfo::Recruiter

◆ Security

AccountTypes AccountInfo::Security

◆ SecurityLevel

AccountTypes AccountInfo::SecurityLevel = SEC_PLAYER

◆ SessionKey

::SessionKey AccountInfo::SessionKey

◆ TotalTime

uint32 AccountInfo::TotalTime