public static void Main(string[] args) { if (args.Length != 3) { System.Console.Out.WriteLine("Usage: Authenticator accountname password role"); return; } Authenticator auth = new Authenticator(); string accountName = args[0].ToLower(); string password = args[1]; string role = args[2]; User user = (User)auth.GetUser(args[0]); if (user == null) { user = new User(); user.AccountName = accountName; auth.userMap[accountName] = user; logger.LogCritical(ILogger_Fields.SECURITY, "New user created: " + accountName); } string newHash = auth.HashPassword(password, accountName); user.SetHashedPassword(newHash); user.AddRole(role); user.Enable(); user.Unlock(); auth.SaveUsers(); long ticks_two = auth.lastModified; long ticks = auth.userDB.LastWriteTime.Ticks; System.Console.Out.WriteLine("User account " + user.AccountName + " updated"); }
public static void Main(string[] args) { if (args.Length != 3) { Console.Out.WriteLine("Usage: Authenticator accountname password role"); } else { Authenticator authenticator = new Authenticator(); string lower = args[0].ToLower(); string password = args[1]; string role = args[2]; User user = (User)authenticator.GetUser(args[0]); if (user == null) { user = new User(); user.AccountName = lower; authenticator.userMap[(object)lower] = (object)user; Authenticator.logger.LogCritical(ILogger_Fields.SECURITY, "New user created: " + lower); } string hash = authenticator.HashPassword(password, lower); user.SetHashedPassword(hash); user.AddRole(role); user.Enable(); user.Unlock(); authenticator.SaveUsers(); long lastModified = authenticator.lastModified; long ticks = authenticator.userDB.LastWriteTime.Ticks; Console.Out.WriteLine("User account " + user.AccountName + " updated"); } }
public static void Main(string[] args) { if (args.Length != 3) { System.Console.Out.WriteLine("Usage: Authenticator accountname password role"); return; } Authenticator auth = new Authenticator(); string accountName = args[0].ToLower(); string password = args[1]; string role = args[2]; User user = (User) auth.GetUser(args[0]); if (user == null) { user = new User(); user.AccountName = accountName; auth.userMap[accountName] = user; logger.LogCritical(ILogger_Fields.SECURITY, "New user created: " + accountName); } string newHash = auth.HashPassword(password, accountName); user.SetHashedPassword(newHash); user.AddRole(role); user.Enable(); user.Unlock(); auth.SaveUsers(); long ticks_two = auth.lastModified; long ticks = auth.userDB.LastWriteTime.Ticks; System.Console.Out.WriteLine("User account " + user.AccountName + " updated"); }