Refactor Account & Password Length (#129)
This commit is contained in:
parent
5a4ed6d0d6
commit
0eb525f992
@ -48,6 +48,11 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
|||||||
return AOR_NAME_TOO_LONG; // username's too long
|
return AOR_NAME_TOO_LONG; // username's too long
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (utf8length(password) > MAX_PASSWORD_STR)
|
||||||
|
{
|
||||||
|
return AOR_PASS_TOO_LONG; // password too long
|
||||||
|
}
|
||||||
|
|
||||||
normalizeString(username);
|
normalizeString(username);
|
||||||
normalizeString(password);
|
normalizeString(password);
|
||||||
|
|
||||||
@ -128,7 +133,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
|
|||||||
return AOR_NAME_TOO_LONG;
|
return AOR_NAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
if (utf8length(new_passwd) > MAX_PASSWORD_STR)
|
||||||
{
|
{
|
||||||
return AOR_PASS_TOO_LONG;
|
return AOR_PASS_TOO_LONG;
|
||||||
}
|
}
|
||||||
@ -157,7 +162,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
|||||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
if (utf8length(new_passwd) > MAX_PASSWORD_STR)
|
||||||
{
|
{
|
||||||
return AOR_PASS_TOO_LONG;
|
return AOR_PASS_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ enum AccountOpResult
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_ACCOUNT_STR 16
|
#define MAX_ACCOUNT_STR 16
|
||||||
|
#define MAX_PASSWORD_STR 16
|
||||||
|
|
||||||
class AccountMgr
|
class AccountMgr
|
||||||
{
|
{
|
||||||
@ -61,4 +62,5 @@ class AccountMgr
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define sAccountMgr MaNGOS::Singleton<AccountMgr>::Instance()
|
#define sAccountMgr MaNGOS::Singleton<AccountMgr>::Instance()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user