Login errors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DESKTOP-DPA61F8\Benedek 2021-04-26 23:17:34 +02:00
parent 098e279eb8
commit 92c0f4a90a

View File

@ -56,13 +56,13 @@ def printCommand():
' List content of current directory -> LST \n' +
' Upload file to current directory -> UPL <filename> \n' +
' Download file from current directory -> DNL <filename> \n' +
' Login -> LIN <username> \n' +
' Login -> LIN <username> <password> \n' +
' Logout -> LOUT \n')
def printCommandsWihtoutLogin():
print('\nYou must log in before issuing other commads!\n',
' Login -> LIN <username> \n',
' Login -> LIN <username> <password> \n',
' Exit -> EXIT\n')
@ -99,14 +99,20 @@ while True:
print("Invalid command format!")
continue
if separatedCommand[0] == 'LIN' and len(separatedCommand) == 2:
if separatedCommand[0] == 'LIN' and len(separatedCommand) == 3:
network = NetWrapper(CLIENT_PRIVATE_KEY, CLIENT_ADDRESS, separatedCommand[1], SERVER_PUBLIC_KEY)
try:
network.connectToServer(separatedCommand[2])
response = network.recieveMessage().decode('UTF-8')
print(response)
if response == 'OK':
LOGGED_IN = True
else:
LOGGED_IN = False
except Exception as e:
print("Error: "+str(e))
LOGGED_IN = False
continue
LOGGED_IN = True
continue
if separatedCommand[0] == 'EXIT':
@ -181,3 +187,4 @@ while True:
except Exception as e:
print('Error: ' + str(e))
continue