Added authcode.txt, which will contain the auth code until the auth system is disabled. GSPs may provide this with the thought that users will be able to become superadmin a lot easier than before.
Fixed numerous cases where paths were incorrect, thanks to what ever dev has a Paths.Combine fetish, and doesn't want to use the obsolete function.
This commit is contained in:
parent
525cc0241d
commit
b629c6e48f
2 changed files with 17 additions and 3 deletions
|
|
@ -1547,7 +1547,8 @@ namespace TShockAPI
|
|||
args.Player.SendMessage("Your new account has been verified, and the /auth system has been turned off.");
|
||||
args.Player.SendMessage("You can always use the /user command to manage players. Do not just delete the auth.lck file.");
|
||||
args.Player.SendMessage("Thankyou for using TShock! http://tshock.co/ & http://github.com/TShock/TShock");
|
||||
FileTools.CreateFile(TShock.SavePath + "auth.lck");
|
||||
FileTools.CreateFile(Path.Combine(TShock.SavePath, "auth.lck"));
|
||||
System.IO.File.Delete(Path.Combine(TShock.SavePath + "authcode.txt"));
|
||||
TShock.AuthToken = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -248,13 +248,26 @@ namespace TShockAPI
|
|||
public static int AuthToken = -1;
|
||||
private void OnPostInit()
|
||||
{
|
||||
if (!File.Exists(Path.Combine(SavePath, "auth.lck")))
|
||||
if (!File.Exists(Path.Combine(SavePath, "auth.lck")) && !File.Exists(Path.Combine(SavePath, "authcode.txt")))
|
||||
{
|
||||
var r = new Random((int)DateTime.Now.ToBinary());
|
||||
AuthToken = r.Next(100000, 10000000);
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("TShock Notice: To become SuperAdmin, join the game and type /auth " + AuthToken);
|
||||
Console.WriteLine("This token will display until disabled by verification.");
|
||||
Console.WriteLine("This token will display until disabled by verification. (/auth-verify)");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
TextWriter tw = new StreamWriter(Path.Combine(SavePath, "authcode.txt"));
|
||||
tw.WriteLine(AuthToken);
|
||||
tw.Close();
|
||||
} else if (File.Exists(Path.Combine(SavePath, "authcode.txt")))
|
||||
{
|
||||
TextReader tr = new StreamReader(Path.Combine(SavePath, "authcode.txt"));
|
||||
AuthToken = Convert.ToInt32(tr.ReadLine());
|
||||
tr.Close();
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("TShock Notice: authcode.txt is still present, and the AuthToken located in that file will be used.");
|
||||
Console.WriteLine("To become superadmin, join the game and type /auth " + AuthToken);
|
||||
Console.WriteLine("This token will display until disabled by verification. (/auth-verify)");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
} else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue