Merge pull request #1640 from Pryaxis/deleted-users-go-guest
Deleted users go guest
This commit is contained in:
commit
56f3db6927
2 changed files with 6 additions and 1 deletions
|
|
@ -89,6 +89,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
||||||
* Enabled banning unregistered users (@QuiCM)
|
* Enabled banning unregistered users (@QuiCM)
|
||||||
* Added filtering and validation on packet 96 (Teleport player through portal) (@QuiCM)
|
* Added filtering and validation on packet 96 (Teleport player through portal) (@QuiCM)
|
||||||
* Update tracker now uses TLS (@pandabear41)
|
* Update tracker now uses TLS (@pandabear41)
|
||||||
|
* When deleting an user account, any player logged in to that account is now logged out properly (@Enerdy)
|
||||||
|
|
||||||
## TShock 4.3.25
|
## TShock 4.3.25
|
||||||
* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.
|
* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.
|
||||||
|
|
|
||||||
|
|
@ -95,13 +95,17 @@ namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tempuser = GetUserAccount(account);
|
// Logout any player logged in as the account to be removed
|
||||||
|
TShock.Players.Where(p => p?.IsLoggedIn == true && p.Account.Name == account.Name).ForEach(p => p.Logout());
|
||||||
|
|
||||||
|
UserAccount tempuser = GetUserAccount(account);
|
||||||
int affected = _database.Query("DELETE FROM Users WHERE Username=@0", account.Name);
|
int affected = _database.Query("DELETE FROM Users WHERE Username=@0", account.Name);
|
||||||
|
|
||||||
if (affected < 1)
|
if (affected < 1)
|
||||||
throw new UserAccountNotExistException(account.Name);
|
throw new UserAccountNotExistException(account.Name);
|
||||||
|
|
||||||
Hooks.AccountHooks.OnAccountDelete(tempuser);
|
Hooks.AccountHooks.OnAccountDelete(tempuser);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue