feat(Scripts/Commands): account set email (#19481)
* added worldserver command to set email address * reverted sql, added Tail args * removed pointer * Added helper text via updatescript * fix build * fix build * fixed db update * Update data/sql/updates/db_world/2024_07_26_01.sql Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Update data/sql/updates/db_world/2024_07_26_01.sql Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * fixed hander * refactor with named params * refactor with named params --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -58,6 +58,33 @@ namespace AccountMgr
|
||||
return AOR_OK; // everything's fine
|
||||
}
|
||||
|
||||
AccountOpResult ChangeEmail(uint32 accountId, std::string newEmail)
|
||||
{
|
||||
std::string username;
|
||||
|
||||
if (!GetName(accountId, username))
|
||||
{
|
||||
sScriptMgr->OnFailedEmailChange(accountId);
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
}
|
||||
|
||||
if (utf8length(newEmail) > MAX_EMAIL_STR)
|
||||
{
|
||||
sScriptMgr->OnFailedEmailChange(accountId);
|
||||
return AOR_EMAIL_TOO_LONG; // email's too long
|
||||
}
|
||||
|
||||
Utf8ToUpperOnlyLatin(newEmail);
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EMAIL);
|
||||
stmt->SetData(0, newEmail);
|
||||
stmt->SetData(1, accountId);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
sScriptMgr->OnEmailChange(accountId);
|
||||
return AOR_OK;
|
||||
}
|
||||
|
||||
AccountOpResult DeleteAccount(uint32 accountId)
|
||||
{
|
||||
// Check if accounts exists
|
||||
|
||||
Reference in New Issue
Block a user