Example #1
0
 public static void AddAnonymousUser()
 {
     Global.User anonuser = new Global.User();
     anonuser.username    = "******";
     anonuser.password    = Global.hashedAnonymousPassword;
     anonuser.banned      = false;
     anonuser.banReason   = "";
     anonuser.bannedUntil = "";
     WriteUserToXML(anonuser);
 }
Example #2
0
            public static void WriteUserToXML(Global.User userObj)
            {
                XmlElement user = (XmlElement)xmlusers.AppendChild(xmldoc.CreateElement("User"));

                user.SetAttribute("username", userObj.username);
                user.SetAttribute("password", userObj.password);
                user.SetAttribute("banned", userObj.banned.ToString());
                user.SetAttribute("banReason", userObj.banReason);
                user.SetAttribute("bannedUntil", userObj.bannedUntil);
                xmldoc.Save(xmlFilePath);
            }
Example #3
0
            public static void RegisterUser(Global.Messages.Registration package)
            {
                Global.User user = new Global.User();
                user.username    = package.username;
                user.password    = BCryptHelper.HashPassword(package.password, BCryptHelper.GenerateSalt());
                user.banned      = false;
                user.banReason   = "";
                user.bannedUntil = "";

                WriteUserToXML(user);
            }