Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def login():
- print('Welcome to the eHealth program, please sign in')
- with open ('users.csv') as csvfile:
- database = csv.DictReader(csvfile)
- loggedin = False
- while loggedin != True:
- Username = input('Fill in your username: ')
- Password = input('Fill in your password: ')
- for row in database:
- Username_File = row['username']
- Password_File = row['password']
- Function_File = row['function']
- if Username_File == Username and Password_File == Password and Function_File == 'patient':
- loggedin = True
- print('Succesfully logged in as a patient.')
- #patientmenu() # we will add this later on
- elif Username_File == Username and Password_File == Password and Function_File == 'arts':
- loggedin = True
- print('Succesfully logged in as a doctor.')
- #artsmenu() # we will add this later on
- elif Username_File != Username and Password_File == Password:
- #loggedin = False
- print('Failed to sign in, wrong username.')
- elif Username_File == Username and Password_File != Password:
- #loggedin = False
- print('Failed to sign in, wrong password.')
- elif Username_File != Username and Password_File != Password:
- #loggedin = False
- print('Failed to sign in, wrong username and password.')
- else:
- print('Error 404, Login Not Found')
- # ---- Main ---- #
- login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement