login, logout in server, invoke server's logout in netwrapper

This commit is contained in:
Attila Szigeti 2021-04-25 14:28:29 +02:00
parent a5b77d0306
commit 977b87634c
2 changed files with 13 additions and 3 deletions

View File

@ -120,6 +120,7 @@ class NetWrapper:
return self.recieveEncryptedMessage(msg) return self.recieveEncryptedMessage(msg)
def logout(self) -> None: def logout(self) -> None:
self.serverInstance.logout()
self.clientAddr = "" self.clientAddr = ""
self.cipherkey = "".encode('UTF-8') self.cipherkey = "".encode('UTF-8')
self.currentClientPublicKey = "".encode('UTF-8') self.currentClientPublicKey = "".encode('UTF-8')

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from server.authentication import Authetication
from executor import Executor from executor import Executor
@ -18,10 +18,19 @@ class Server:
self.executor = Executor(homeDirectory) self.executor = Executor(homeDirectory)
def login(self, username: str, password: str) -> bool: def login(self, username: str, password: str) -> bool:
pass auth = Authetication()
self.isAuthenticated = True
home_directory = auth.login(username, password)
if not home_directory:
return False
else:
return True
def logout(self) -> None: def logout(self) -> None:
pass self.isAuthenticated = False
self.availableServer = False
self.homeDirectory = ""
self.currentDirectory = ""
def parseCommand(self, command: str) -> str: def parseCommand(self, command: str) -> str:
parsedCommand = command.split(" ") parsedCommand = command.split(" ")