Adds a configuration file to specify protected accounts:
_Distribution/Configuration/server-access.json_
```json
{
"newPasswordOnReset": false,
"protectedAccounts": ["admin"]
}
```
Protected accounts are unbanned and reset to `AccessLevel.Owner` upon login.
The option `newPasswordOnReset` will create a new password for a protected account if it needs to be reset. The password is a random GUID and logged to the console.
_**Note:**_ If your player character was accidentally modified, simply make a new character to fix the old one.
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System;
|
|
using Server.Accounting;
|
|
|
|
namespace Server.Misc
|
|
{
|
|
public static class AccountPrompt
|
|
{
|
|
public static void Initialize()
|
|
{
|
|
if (Accounts.Count == 0)
|
|
{
|
|
Console.WriteLine("This server has no accounts.");
|
|
Console.Write("Do you want to create the owner account now? (y/n): ");
|
|
|
|
var answer = Console.ReadLine();
|
|
if (answer is "y" or "Y")
|
|
{
|
|
Console.WriteLine();
|
|
|
|
Console.Write("Username: ");
|
|
var username = Console.ReadLine();
|
|
|
|
Console.Write("Password: ");
|
|
var password = Console.ReadLine();
|
|
|
|
var a = new Account(username, password);
|
|
a.AccessLevel = AccessLevel.Owner;
|
|
|
|
Console.WriteLine("Account created.");
|
|
|
|
ServerAccess.AddProtectedAccount(a, true);
|
|
Console.WriteLine("Added {0} to the protected accounts list.", a.Username);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine();
|
|
Console.WriteLine("Account not created.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|