Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. # sample login application with a couple test members login info to test against
  2.  
  3. memeber_login_info = {"email@email.com": "12345678", "willy@wonka.com": "19841971#", "comingto@america.com": "1988princeAKEEM$"}
  4.  
  5.  
  6. def login():
  7.  
  8. # user inputs email and password, in this test if the login info doesn't match
  9. # one of the three test member's info the user will be told, "invalid email or password"
  10. # and allowed to re-enter, when they input the right login info they'll be told
  11. # "login successful"
  12.  
  13. print("Enter login email: ")
  14. email = input()
  15. print("Enter password: ")
  16. login_password = input()
  17.  
  18. for login, pass_info in memeber_login_info.items():
  19. if login == email and pass_info == login_password:
  20. print("Login successful")
  21. break
  22.  
  23. else:
  24.  
  25. count = 3
  26. while count > 0:
  27.  
  28. print("Invalid email or password")
  29.  
  30. print("Enter login email: ")
  31. email = input()
  32. print("Enter password: ")
  33. login_password = input()
  34.  
  35. count = count -1
  36.  
  37. if email in memeber_login_info.keys() and login_password in memeber_login_info.values():
  38. if memeber_login_info[email] == login_password:
  39. print("Login successful")
  40. break
  41.  
  42.  
  43. elif count == 0:
  44. print("Forgot password?")
  45.  
  46.  
  47.  
  48. login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement