Advertisement
Guest User

Untitled

a guest
Jan 20th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. def login():
  2. print('Welcome to the eHealth program, please sign in')
  3.  
  4. with open ('users.csv') as csvfile:
  5. database = csv.DictReader(csvfile)
  6. loggedin = False
  7. while loggedin != True:
  8. Username = input('Fill in your username: ')
  9. Password = input('Fill in your password: ')
  10. for row in database:
  11. Username_File = row['username']
  12. Password_File = row['password']
  13. Function_File = row['function']
  14. if Username_File == Username and Password_File == Password and Function_File == 'patient':
  15. loggedin = True
  16. print('Succesfully logged in as a patient.')
  17. #patientmenu() # we will add this later on
  18. elif Username_File == Username and Password_File == Password and Function_File == 'arts':
  19. loggedin = True
  20. print('Succesfully logged in as a doctor.')
  21. #artsmenu() # we will add this later on
  22. elif Username_File != Username and Password_File == Password:
  23. #loggedin = False
  24. print('Failed to sign in, wrong username.')
  25. elif Username_File == Username and Password_File != Password:
  26. #loggedin = False
  27. print('Failed to sign in, wrong password.')
  28. elif Username_File != Username and Password_File != Password:
  29. #loggedin = False
  30. print('Failed to sign in, wrong username and password.')
  31. else:
  32. print('Error 404, Login Not Found')
  33.  
  34. # ---- Main ---- #
  35. login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement