Guest User

Untitled

a guest
Oct 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. while(old_password!=self.password_str):
  2. AttributeError: 'Player' object has no attribute 'password_str'
  3.  
  4. class Player(object):
  5.  
  6. def __init__(self, username_str="-", password_str=""):
  7. while (not validated(password_str)):
  8. self.password_str=input("Password is invalid. Please try again:")
  9. self.username=username_str
  10.  
  11. def change_password(self,old_password):
  12. MAX_ATTEMPT=3
  13. num_of_fails=0
  14. while(old_password!=self.password_str):
  15. num_of_fails+=1
  16. if(num_of_fails<MAX_ATTEMPT):
  17. old_password=input("Thej passwword entered is invalid. Please try again.
  18. (You have "+str(MAX_ATTEMPT-num_of_fails)+" attempts reamining)")
  19. else:
  20. print("Incorrect password entered too many times. Your account is temporarily locked.")
  21. break
  22.  
  23. if(num_of_fails<MAX_ATTEMPT):
  24. new_password=input("please enter a new password.")
  25.  
  26. while(not validated(new_password)):
  27. new_password=input("New password is invalid. Please try again")
  28.  
  29. self.password_str=new_password
  30. print("Password has been successfully changed!")
Add Comment
Please, Sign In to add comment