From 71440207cdaecea96f09f71861eb7b3af2c7d44e Mon Sep 17 00:00:00 2001 From: Michael VanOverbeek Date: Mon, 10 Apr 2017 20:46:36 +0000 Subject: [PATCH] Force lowercase usernames. --- ShiftOS.Server/SaveManager.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ShiftOS.Server/SaveManager.cs b/ShiftOS.Server/SaveManager.cs index e986ecd..a277b6d 100644 --- a/ShiftOS.Server/SaveManager.cs +++ b/ShiftOS.Server/SaveManager.cs @@ -43,7 +43,7 @@ namespace ShiftOS.Server var args = contents as Dictionary; if (!args.ContainsKey("username")) throw new MudException("No 'username' argument supplied."); - + args["username"] = args["username"].ToString().ToLower(); foreach(var savefile in Directory.GetFiles("saves")) { var save = ReadSave(savefile); @@ -64,6 +64,7 @@ namespace ShiftOS.Server var args = contents as Dictionary; if (args["username"] != null && args["password"] != null) { + args["username"] = args["username"].ToString().ToLower(); foreach (var savefile in Directory.GetFiles("saves")) { try @@ -122,6 +123,7 @@ namespace ShiftOS.Server var args = contents as Dictionary; if (args["username"] != null && args["password"] != null) { + args["username"] = args["username"].ToString().ToLower(); foreach (var savefile in Directory.GetFiles("saves")) { try @@ -162,7 +164,7 @@ namespace ShiftOS.Server public static void SaveGame(string guid, object contents) { var sav = contents as Save; - + sav.Username = sav.Username.ToLower(); WriteEncFile("saves/" + sav.Username + ".save", JsonConvert.SerializeObject(sav, Formatting.Indented)); @@ -181,7 +183,7 @@ namespace ShiftOS.Server public static void DeleteSave(string guid, object contents) { var cSave = contents as ClientSave; - + cSave.Username = cSave.Username.ToLower(); foreach(var saveFile in Directory.GetFiles("saves")) { try @@ -204,6 +206,7 @@ namespace ShiftOS.Server var args = contents as Dictionary; if (args["username"] != null && args["amount"] != null) { + args["username"] = args["username"].ToString().ToLower(); string userName = args["username"] as string; long cpAmount = (long)args["amount"]; @@ -236,6 +239,7 @@ namespace ShiftOS.Server var args = contents as Dictionary; if (args["username"] != null && args["password"] != null && args["amount"] != null && args["yourusername"] != null) { + args["username"] = args["username"].ToString().ToLower(); string userName = args["username"] as string; string passw = args["password"] as string; int cpAmount = (int)args["amount"];