Advertisement
Guest User

Untitled

a guest
May 4th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. def user_input(x,un,pw):
  2. if (x==0):
  3. print("password incorrect ")
  4. changepw(un)
  5. user_input(3,un,pw)
  6. else:
  7. if d[un]==pw:
  8. print("correct password:"+pw)
  9. display_menu()
  10. else:
  11. pw=input('invalid password, enter password again : ')
  12. user_input(x-1,un,pw)
  13.  
  14. def changepw(un):
  15. npw=(input('Invalid password- enter new password to update account : '))
  16. d[un]=npw
  17.  
  18. def update_database():
  19. file = open("password.txt","w")
  20. dlst=[]
  21. for value in dict.iteritems():
  22. password = [value]
  23. dlst.append(password)
  24.  
  25. def checkun(un):
  26. if un in d:
  27. return True
  28. else:
  29. return False
  30.  
  31.  
  32. def display_menu():
  33. print("MAIN MENU : ")
  34. print('A.Investment Projection')
  35. print('B.Rettirement Planning')
  36. print('C.Mortgage')
  37. print('D.College Fund')
  38. print('E.Exit')
  39.  
  40. def main():
  41. with open("user.txt") as f:
  42. A = [str(x) for x in f.read().split()]
  43.  
  44. with open("password.txt") as j:
  45. B = [str(x) for x in j.read().split()]
  46.  
  47.  
  48. lenA=len(A)
  49. for i in range(lenA):
  50. d[A[i]]=B[i]
  51. print(d)
  52.  
  53. un=input('enter your username:')
  54. pw=input('enter your password:')
  55. while(not(checkun(un))):
  56. un=input('enter your username:')
  57. pw=input('enter your password:')
  58. user_input(3,un,pw)
  59.  
  60. d={}
  61. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement