fix circular dependency
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-04-25 18:40:41 +02:00
parent 798b74e5d8
commit 149c206830
2 changed files with 13 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ class Server:
passphrase = input()
self.auth = Authetication()
self.networkInstance = NetWrapper(self.auth.loadUserPublicKeys(), self.auth.loadServerPrivateKey(passphrase),
self)
self.auth)
def login(self, username: str, password: str) -> bool:
self.isAuthenticated = True
@@ -30,6 +30,7 @@ class Server:
return True
def logout(self) -> None:
self.networkInstance.logout()
self.isAuthenticated = False
self.availableServer = False
self.homeDirectory = ""
@@ -56,7 +57,13 @@ class Server:
def execute(self, command: str, firstParam: str = "", secondParam: str = "") -> None:
if self.homeDirectory == "" or self.executor.currentDirectory == "" or self.executor.baseDir == "":
raise Exception("Directories must not be empty string. Did the user log in?")
if command == "MKD":
if command == "LOUT":
if secondParam != "" or firstParam != "":
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
else:
self.logout()
self.networkInstance.sendMessage("OK".encode('UTF-8'))
elif command == "MKD":
if secondParam != "":
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
else: