@@ -163,7 +163,12 @@ $(document).ready(function () {
|
|||||||
chat.historyMsgs.pop();
|
chat.historyMsgs.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
chat.historyMsgs.unshift(value);
|
if (value.toLowerCase().startsWith("/changepw") && value.length >= "/changepw ".length) {
|
||||||
|
chat.historyMsgs.unshift("/changepw * *");
|
||||||
|
} else {
|
||||||
|
chat.historyMsgs.unshift(value);
|
||||||
|
}
|
||||||
|
|
||||||
chat.currentIndex = 0;
|
chat.currentIndex = 0;
|
||||||
var elmnt = document.getElementById("chat_messages");
|
var elmnt = document.getElementById("chat_messages");
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ 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")]
|
||||||
@@ -114,6 +115,43 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
player.SendChatMessage("~y~[EVENTPORT] ~s~Du hast dich zum Event teleportiert");
|
player.SendChatMessage("~y~[EVENTPORT] ~s~Du hast dich zum Event teleportiert");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("changepw", "~m~Benutzung: ~s~/changepw [Aktuelles Passwort] [Neues Passwort]", SensitiveInfo = true)]
|
||||||
|
public void CmdUserChangePw(Player player, string oldPassword, string newPassword)
|
||||||
|
{
|
||||||
|
if (!player.IsLoggedIn()) return;
|
||||||
|
|
||||||
|
if (oldPassword == newPassword)
|
||||||
|
{
|
||||||
|
ChatService.ErrorMessage(player, "Die eingegebenen Passwörter sind identisch");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newPassword.Length < GlobalHelper.requiredPasswordLength)
|
||||||
|
{
|
||||||
|
ChatService.ErrorMessage(player, "Das neue Passwort muss aus mindestens sechs Zeichen bestehen");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
User user = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
if (user.Password != NAPI.Util.GetHashSha256(oldPassword))
|
||||||
|
{
|
||||||
|
ChatService.ErrorMessage(player, "Du hast dein aktuelles Passwort falsch eingegeben");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.Password = NAPI.Util.GetHashSha256(newPassword);
|
||||||
|
logger.LogInformation("Player {0} changed their password for {1}", player.Name, PASSWORD_CHANGE_FEE.ToMoneyString());
|
||||||
|
|
||||||
|
user.BankAccount.Balance -= PASSWORD_CHANGE_FEE;
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
|
||||||
[Command("sms", "~m~Benutzung: ~s~/sms [Spieler] [Nachricht]", GreedyArg = true)]
|
[Command("sms", "~m~Benutzung: ~s~/sms [Spieler] [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdUserSMS(Player player, string name, string msg)
|
public void CmdUserSMS(Player player, string name, string msg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,14 +25,15 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
string username = player.Name;
|
string username = player.Name;
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
if (password.Length < 6)
|
if (password.Length < GlobalHelper.requiredPasswordLength)
|
||||||
{
|
{
|
||||||
player.TriggerEvent("SERVER:Login_Error", "Das Passwort muss aus mindestens 6 Zeichen bestehen.");
|
player.TriggerEvent("SERVER:Login_Error", "Das Passwort muss aus mindestens sechs Zeichen bestehen.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count() != 0)
|
if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count() != 0)
|
||||||
{
|
{
|
||||||
player.TriggerEvent("SERVER:Login_Error", "Es ist schon ein Konto mit dieser Socialclub-ID registriert.");
|
player.TriggerEvent("SERVER:Login_Error", "Diese Social Club ID wird bereits verwendet.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
{ "Prelex", "zigaretten (Makkaroni)" }
|
{ "Prelex", "zigaretten (Makkaroni)" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static int requiredPasswordLength = 6;
|
||||||
public static int newbiePlayedMinutesThreshold = 30 * 60;
|
public static int newbiePlayedMinutesThreshold = 30 * 60;
|
||||||
|
|
||||||
public static DateTime CountdownUntil { get; internal set; }
|
public static DateTime CountdownUntil { get; internal set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user