More work on scripts.
This commit is contained in:
@@ -167,10 +167,16 @@ namespace Game
|
||||
string username;
|
||||
|
||||
if (!GetName(accountId, out username))
|
||||
{
|
||||
Global.ScriptMgr.OnFailedPasswordChange(accountId);
|
||||
return AccountOpResult.NameNotExist; // account doesn't exist
|
||||
}
|
||||
|
||||
if (newPassword.Length > MaxAccountLength)
|
||||
{
|
||||
Global.ScriptMgr.OnFailedPasswordChange(accountId);
|
||||
return AccountOpResult.PassTooLong;
|
||||
}
|
||||
|
||||
(byte[] salt, byte[] verifier) = SRP6.MakeRegistrationData(username, newPassword);
|
||||
|
||||
@@ -180,38 +186,53 @@ namespace Game
|
||||
stmt.AddValue(2, accountId);
|
||||
DB.Login.Execute(stmt);
|
||||
|
||||
Global.ScriptMgr.OnPasswordChange(accountId);
|
||||
return AccountOpResult.Ok;
|
||||
}
|
||||
|
||||
public AccountOpResult ChangeEmail(uint accountId, string newEmail)
|
||||
{
|
||||
if (!GetName(accountId, out _))
|
||||
{
|
||||
Global.ScriptMgr.OnFailedEmailChange(accountId);
|
||||
return AccountOpResult.NameNotExist; // account doesn't exist
|
||||
}
|
||||
|
||||
if (newEmail.Length > MaxEmailLength)
|
||||
{
|
||||
Global.ScriptMgr.OnFailedEmailChange(accountId);
|
||||
return AccountOpResult.EmailTooLong;
|
||||
}
|
||||
|
||||
PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_EMAIL);
|
||||
stmt.AddValue(0, newEmail);
|
||||
stmt.AddValue(1, accountId);
|
||||
DB.Login.Execute(stmt);
|
||||
|
||||
Global.ScriptMgr.OnEmailChange(accountId);
|
||||
return AccountOpResult.Ok;
|
||||
}
|
||||
|
||||
public AccountOpResult ChangeRegEmail(uint accountId, string newEmail)
|
||||
{
|
||||
if (!GetName(accountId, out _))
|
||||
{
|
||||
Global.ScriptMgr.OnFailedEmailChange(accountId);
|
||||
return AccountOpResult.NameNotExist; // account doesn't exist
|
||||
}
|
||||
|
||||
if (newEmail.Length > MaxEmailLength)
|
||||
{
|
||||
Global.ScriptMgr.OnFailedEmailChange(accountId);
|
||||
return AccountOpResult.EmailTooLong;
|
||||
}
|
||||
|
||||
PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_REG_EMAIL);
|
||||
stmt.AddValue(0, newEmail);
|
||||
stmt.AddValue(1, accountId);
|
||||
DB.Login.Execute(stmt);
|
||||
|
||||
Global.ScriptMgr.OnEmailChange(accountId);
|
||||
return AccountOpResult.Ok;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user