ModernUO/Projects/UOContent/Misc/AccountPrompt.cs
Voxpire b8a8bfd1a9
fix: Fixes console clobbering when prompted to add an owner account (#2133)
### Summary
- Updates AccountPrompt to use `logger` to avoid console clobbering

### Screenshot
![image](https://github.com/user-attachments/assets/8bfbaccc-3c23-4d05-ab49-a656e6a8803f)
2025-02-26 18:43:20 -08:00

40 lines
1.2 KiB
C#

using Server.Accounting;
using Server.Logging;
namespace Server.Misc;
public static class AccountPrompt
{
private static readonly ILogger logger = LogFactory.GetLogger(typeof(AccountPrompt));
public static void Initialize()
{
if (Accounts.Count == 0)
{
logger.Warning("This server has no accounts.");
logger.Information("Do you want to create the owner account now? (y/n):");
var answer = ConsoleInputHandler.ReadLine();
if (answer.InsensitiveEquals("y"))
{
logger.Information("Input Username:");
var username = ConsoleInputHandler.ReadLine();
logger.Information("Input Password:");
var password = ConsoleInputHandler.ReadLine();
var a = new Account(username, password)
{
AccessLevel = AccessLevel.Owner
};
logger.Information("Owner account created: {Username}", username);
ServerAccess.AddProtectedAccount(a, true);
}
else
{
logger.Warning("No owner account created.");
}
}
}
}