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
271 {
272 // 0 1 2 3 4 5 6 7 8 9 10 11
273 // 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,
274 // 12 13
275 // ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id
276 // FROM account a
277 // LEFT JOIN account_access aa ON a.id = aa.AccountID AND aa.RealmID IN (-1, ?)
278 // LEFT JOIN account_banned ab ON a.id = ab.id
279 // LEFT JOIN account r ON a.id = r.recruiter
280 // WHERE a.username = ? ORDER BY aa.RealmID DESC LIMIT 1
281 Id = fields[0].Get<uint32>();
282 SessionKey = fields[1].Get<Binary, SESSION_KEY_LENGTH>();
283 LastIP = fields[2].Get<std::string>();
284 IsLockedToIP = fields[3].Get<bool>();
285 LockCountry = fields[4].Get<std::string>();
286 Expansion = fields[5].Get<uint8>();
287 MuteTime = fields[6].Get<int64>();
288 Locale = LocaleConstant(fields[7].Get<uint8>());
289 Recruiter = fields[8].Get<uint32>();
290 OS = fields[9].Get<std::string>();
291 TotalTime = fields[10].Get<uint32>();
292 Security = AccountTypes(fields[11].Get<uint8>());
293 IsBanned = fields[12].Get<uint64>() != 0;
294 IsRectuiter = fields[13].Get<uint32>() != 0;
295
296 uint32 world_expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
297 if (Expansion > world_expansion)
298 Expansion = world_expansion;
299
300 if (Locale >= TOTAL_LOCALES)
302 }
LocaleConstant
Definition: Common.h:74
@ TOTAL_LOCALES
Definition: Common.h:85
@ LOCALE_enUS
Definition: Common.h:75
AccountTypes
Definition: Common.h:65
constexpr size_t SESSION_KEY_LENGTH
Definition: AuthDefines.h:24
std::array< uint8, SESSION_KEY_LENGTH > SessionKey
Definition: AuthDefines.h:25
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
std::uint64_t uint64
Definition: Define.h:107
std::int64_t int64
Definition: Define.h:103
std::vector< uint8 > Binary
Definition: Field.h:41
@ CONFIG_EXPANSION
Definition: IWorld.h:274
#define sWorld
Definition: World.h:451
std::string LockCountry
Definition: AuthSession.h:55
std::string OS
Definition: WorldSocket.cpp:264
uint32 Recruiter
Definition: WorldSocket.cpp:263
LocaleConstant Locale
Definition: WorldSocket.cpp:262
int64 MuteTime
Definition: WorldSocket.cpp:261
bool IsRectuiter
Definition: WorldSocket.cpp:265
AccountTypes Security
Definition: WorldSocket.cpp:266
uint32 Id
Definition: AuthSession.h:52
bool IsBanned
Definition: AuthSession.h:58
bool IsLockedToIP
Definition: AuthSession.h:54
std::string LastIP
Definition: AuthSession.h:56
uint8 Expansion
Definition: WorldSocket.cpp:260
uint32 TotalTime
Definition: WorldSocket.cpp:268
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)
141{
142 // 0 1 2 3 4 5
143 // SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins,
144 // 6 7
145 // ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate,
146 // 8 9
147 // ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate,
148 // 10
149 // aa.gmlevel (, more query-specific fields)
150 // 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 = ?
151
152 Id = fields[0].Get<uint32>();
153 Login = fields[1].Get<std::string>();
154 IsLockedToIP = fields[2].Get<bool>();
155 LockCountry = fields[3].Get<std::string>();
156 LastIP = fields[4].Get<std::string>();
157 FailedLogins = fields[5].Get<uint32>();
158 IsBanned = fields[6].Get<bool>() || fields[8].Get<bool>();
159 IsPermanentlyBanned = fields[7].Get<bool>() || fields[9].Get<bool>();
160 SecurityLevel = static_cast<AccountTypes>(fields[10].Get<uint8>()) > SEC_CONSOLE ? SEC_CONSOLE : static_cast<AccountTypes>(fields[10].Get<uint8>());
161
162 // Use our own uppercasing of the account name instead of using UPPER() in mysql query
163 // This is how the account was created in the first place and changing it now would result in breaking
164 // login for all accounts having accented characters in their name
166}
@ SEC_CONSOLE
Definition: Common.h:70
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition: Util.cpp:528
uint32 FailedLogins
Definition: AuthSession.h:57
bool IsPermanentlyBanned
Definition: AuthSession.h:59
AccountTypes SecurityLevel
Definition: AuthSession.h:60
std::string Login
Definition: AuthSession.h:53

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