implement account support
This commit is contained in:
parent
67461db7c1
commit
d6d0f12626
3 changed files with 18 additions and 3 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 0440abd027aeb35299ea05f275841a9ef012a6f4
|
||||
Subproject commit 7117823772a3615890dfc833bce81cc05be15426
|
|
@ -31,7 +31,8 @@ public class ConfigVM
|
|||
public string Name { get; set; }
|
||||
public string URL { get; set; }
|
||||
public string Node { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public string? Token { get; set; }
|
||||
public ulong[]? DiscordMods { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,16 @@ public class VM
|
|||
public VM(string username, ConfigVM config, Database db)
|
||||
{
|
||||
this.Config = config;
|
||||
if (this.Config.Password == null && this.Config.Token == null)
|
||||
{
|
||||
Utilities.Log(LogLevel.FATAL, $"VM {this.Config.Name} has no password or token set.");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
if (this.Config.Password != null && this.Config.Token != null)
|
||||
{
|
||||
Utilities.Log(LogLevel.FATAL, $"VM {this.Config.Name} has both a password and token set.");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
this.username = username;
|
||||
this.database = db;
|
||||
retryTimer.Interval = 1000;
|
||||
|
@ -91,7 +101,11 @@ public class VM
|
|||
retryTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.Config.Password != null)
|
||||
await cvm.Login(Config.Password);
|
||||
else
|
||||
await cvm.LoginAccount(Config.Token!);
|
||||
GotAuth.TrySetResult(null);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue