Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import re
  2.  
  3. class PasswordValidation:
  4.  
  5. @staticmethod
  6. def strong_password(strong_password):
  7. has_digit = True if re.search('\d', strong_password) else False
  8. has_up = True if re.search("[A-Z]", strong_password) else False
  9. has_low = True if re.search("[a-z]", strong_password) else False
  10. test_len = len(strong_password) >= 12
  11. test_123 = "123" not in strong_password
  12. result = has_digit and has_up and has_low and test_len and test_123
  13.  
  14. return result
  15.  
  16. print(PasswordValidation.strong_password("Strong3Password")) #Strong password
  17. print(PasswordValidation.strong_password("strong1password")) #Weak password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement