finish migration to Pilz.NET
This commit is contained in:
@@ -12,7 +12,7 @@ using Pilz.Plugins.Advanced;
|
||||
|
||||
namespace OwnChar.Server;
|
||||
|
||||
internal class ServerContext(ISettings settings) : ApiServer(settings.Get<ServerSettings>().ApiUrl!), IServer
|
||||
internal class ServerContext(ISettings settings) : ApiServer(settings.Get<ServerSettings>().ApiUrl!), IOwnCharServer
|
||||
{
|
||||
private readonly Dictionary<string, UserAccountBase> users = [];
|
||||
|
||||
@@ -47,12 +47,19 @@ internal class ServerContext(ISettings settings) : ApiServer(settings.Get<Server
|
||||
|
||||
protected override string? DecodeAuthKey(string authKey)
|
||||
{
|
||||
return base.DecodeAuthKey(new SecureString(authKey, true));
|
||||
if (!string.IsNullOrWhiteSpace(authKey))
|
||||
return new SecureString(authKey, true).Value;
|
||||
return authKey;
|
||||
}
|
||||
|
||||
protected override bool CheckAuthentication(string authKey)
|
||||
{
|
||||
return base.CheckAuthentication(authKey) || IsLoggedIn(authKey);
|
||||
return string.IsNullOrWhiteSpace(authKey)
|
||||
|| authKey.Split(":") is not string[] authKeyParts
|
||||
|| authKey.Length != 2
|
||||
|| string.IsNullOrWhiteSpace(authKeyParts[0])
|
||||
|| string.IsNullOrWhiteSpace(authKeyParts[1])
|
||||
|| !IsLoggedIn(authKeyParts[1]);
|
||||
}
|
||||
|
||||
public string Login(UserAccountBase account)
|
||||
|
||||
Reference in New Issue
Block a user