keine macht dem kapitalismus; passwörter darf man jetzt kostenlos ändern :^)
This commit is contained in:
@@ -22,7 +22,6 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
private static readonly ILogger logger = LogManager.GetLogger<UserCommands>();
|
private static readonly ILogger logger = LogManager.GetLogger<UserCommands>();
|
||||||
|
|
||||||
private const int PASSWORD_CHANGE_FEE = 5000;
|
|
||||||
private const int SMS_PRICE = 5;
|
private const int SMS_PRICE = 5;
|
||||||
|
|
||||||
[Command("rent", "~m~rent stop")]
|
[Command("rent", "~m~rent stop")]
|
||||||
@@ -135,12 +134,6 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
DatabaseContext dbContext = new DatabaseContext();
|
DatabaseContext dbContext = new DatabaseContext();
|
||||||
User user = player.GetUser(dbContext);
|
User user = player.GetUser(dbContext);
|
||||||
|
|
||||||
if (user.BankAccount.Balance < PASSWORD_CHANGE_FEE)
|
|
||||||
{
|
|
||||||
ChatService.ErrorMessage(player, $"Für eine Passwortänderung benötigst du mindestens { PASSWORD_CHANGE_FEE.ToMoneyString() }");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.Password != NAPI.Util.GetHashSha256(oldPassword))
|
if (user.Password != NAPI.Util.GetHashSha256(oldPassword))
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "Du hast dein aktuelles Passwort falsch eingegeben");
|
ChatService.ErrorMessage(player, "Du hast dein aktuelles Passwort falsch eingegeben");
|
||||||
@@ -148,11 +141,10 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
user.Password = NAPI.Util.GetHashSha256(newPassword);
|
user.Password = NAPI.Util.GetHashSha256(newPassword);
|
||||||
user.BankAccount.Balance -= PASSWORD_CHANGE_FEE;
|
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
ChatService.SendMessage(player, $"~y~[ACCOUNT] ~s~Du hast dein Passwort erfolgreich geändert. Dir wurden ~y~{ PASSWORD_CHANGE_FEE.ToMoneyString() } ~s~in Rechnung gestellt.");
|
ChatService.SendMessage(player, $"~y~[ACCOUNT] ~s~Du hast dein Passwort erfolgreich geändert.");
|
||||||
logger.LogInformation("Player {0} changed their password for {1}", player.Name, PASSWORD_CHANGE_FEE.ToMoneyString());
|
logger.LogInformation("Player {0} changed their password", player.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("sms", "~m~Benutzung: ~s~/sms [Spieler] [Nachricht]", GreedyArg = true)]
|
[Command("sms", "~m~Benutzung: ~s~/sms [Spieler] [Nachricht]", GreedyArg = true)]
|
||||||
|
|||||||
Reference in New Issue
Block a user