When a user registers they need a secure password which has specific requirements (see task). Ensure the password that is entered by the user is 'secure'. Enable this feature within the registration process
Note: See if you can do better (and you should be able to). The solutions provided are basic, and allow for discussion on possible alternative methods and solutions.
#Netflix type system demo - FakeFlix import csv import sys import string #for use in the secure password and other parts of the program def main(): menu() def menu(): print("************Welcome to FakeFlix Demo**************") print() choice = input(""" A: Please Register B: Login Q: Logout Please enter your choice: """) if choice == "A" or choice =="a": register() elif choice == "B" or choice =="b": login() elif choice=="Q" or choice=="q": sys.exit else: print("You must only select either A or B") print("Please try again") menu() def long_enough(pw): 'Password must be at least 6 characters' return len(pw) >= 6 def short_enough(pw): 'Password cannot be more than 12 characters' return len(pw) <= 12 def has_lowercase(pw): 'Password must contain a lowercase letter' return len(set(string.ascii_lowercase).intersection(pw)) > 0 def has_uppercase(pw): 'Password must contain an uppercase letter' return len(set(string.ascii_uppercase).intersection(pw)) > 0 def has_numeric(pw): 'Password must contain a digit' return len(set(string.digits).intersection(pw)) > 0 def has_special(pw): 'Password must contain a special character' return len(set(string.punctuation).intersection(pw)) > 0 def test_password(pw, tests=[long_enough, short_enough, has_lowercase, has_uppercase, has_numeric, has_special]): for test in tests: if not test(pw): print(test.__doc__) return False return True def register(): #user is prompted to input all the required fields print("Enter first name") global firstname firstname=input() print("Enter surname") global surname surname=input() print("Enter Date of Birth Format: dd/mm/yy") global dob dob=input() print("Enter first line of address") global firstlineaddress firstlineaddress=input() print("Enter Postcode") global postcode postcode=input() print("Enter Gender") global gender gender=input() print("Enter main genre of interest") global interest interest=input() print("Enter email address") global email email=input() substring=dob[-4:] print(substring) print("Your unique username is", firstname+surname+substring) global username username=firstname+surname+substring #secure password checker passwordchecker() def passwordchecker(): password=input("Please enter a password - must be secure and meet our format requirements") if test_password(password): with open('fakeflixfile.txt','a') as fakeflixfile: fakeflixfileWriter=csv.writer(fakeflixfile) fakeflixfileWriter.writerow([username,password,firstname,surname,dob,firstlineaddress,postcode,gender,interest,email]) print("Record has been written to file") fakeflixfile.close() menu() else: passwordchecker() def login(): pass #the program is initiated, so to speak, here main()
Write your own summary of the problem. What are your objectives? List the success criteria
Test No. | Description | Test Data(input) | Expected Outcome | Actual Outcome | Further Action? |
---|---|---|---|---|---|
1 | |||||
2 | |||||
3 | |||||
4 | |||||
5 |