Objectives: Student should be able to: Read and write to a file Search a file Utilize control structures to loop and make desiccation. Introduction In this mini project, you will process some input to...


Objectives:


Student should be able to:




  • Read and write to a file




  • Search a file




  • Utilize control structures to loop and make desiccation.




Introduction


In this mini project, you will process some input to confirm a user account. You will not actually create any accounts, just go through the process of validating some input and writting information to a file.


You will prompt the user for a name to create the username, Then you will prompt for a password, then confirm that password. If that all goes well, you will make one final confirmation. If the user does not exists the will be given the choice to be added to the system.


You will be storing information to a text file. The file will contain user names and passwords (this is typically a bad idea but we don't care). The file contains lines of text. Each line is in the form username::password - where username is a unique username and password is an obfuscated version of the user's password.


The password is stored as follows:




  • A user has a password that is at least 7 characters and does not contain the following characters: ! @ $ : ?




  • Step 1 takes the first and last character in the password and swaps them.




  • Step 2 makes the following substitutions:





    • lowercase i is replaced with !




    • lowercase a is replaced with @




    • uppercase S is replaced with $




    • uppercase J is replaced with ?





For example the password: IsSnappleJuice would be stored es$n@pple?uIcI


A user has a first name and a second name. The username will be the user's first initial concatenated wit their second name. If a user with that username exists in the system, a random 4 digit number is added to the end of username.


See the requirements below for more



Instructions


Write a program that meets the following requirements:




  • If the file does not exist, create a file called users.txt




  • if the file does not exist, create a file called log.txt




  • Ask a user if they have a username.





    • If they are an existing user





      • prompt them for their username




      • check if a line starts with that user name





        • if a line exists, retrieve the username and password.





          • prompt the user for their password




          • encrypt the given password




          • check is the stored password matches the newly encrypted one.




          • append the following to the log file





            • [USERNAME] :: [DATETIME] :: [STATUS]




            • replace [USERNAME] with the current user's username




            • replace [DATETIME] with the current system time





              • you will have to research how to get the date and time (hint: import something)




              • *any date/time format is fine





            • replace status with OK if the passwords match




            • replace status with BAD PASS if the passwords do not match





          • if the passwords do not match, allow the user to try again but after 3 bad attempts the user has failed





            • if this occurs append a new line that has a FAILED status.








    • if they are not an existing user





      • Prompt user for first name




      • Prompt user for second name




      • Search the user file for a line that starts with the username for a user with the given first and second name





        • if a user exists, generate a 2 digit random positive number, append it to the username. Check the file to make sure this is a unique name. Repeat this until a unique name is created.




        • if they do not exisit





          • Create a username as stated above.




          • Prompt the user for their new password





            • The password should be at least 7 characters long.The password cannot contain the special characters stated above.




            • If the password is less than 7 characters or contains the special characters - repeat until a valid password is entered.




            • If the password is valid





              • Prompt the user to re-enter the password




              • If the two passwords match





                • Append the file to include the new username and password as stated above.











  • You need to have fa unction to "encrypt" the password.




  • You need to have a function that takes the line from the file and returns the username part




  • You need to have a function that takes the line from the file and returns the password part




  • You need at least two loops




  • You need at least two if statements




Submission




  • All work
    must be your own - https://cswiki.betheluniversity.edu/index.php?title=AcceptableWork




  • All submissions must have a comment at the top of the code that includes your





    • name and student ID




    • the assignment




    • the course and section




    • a brief description of the program





  • All submissions must be clearly formated and abstractions (such as variables and functions) should have meaningful names to maximize readability.




  • All submissions must have a read me text file that contains the following





    • your name and student ID




    • the assignment




    • the course and section




    • a brief description of the program and any information needed to run your program




    • a completion statement that details what requirements were met, which were not, and what challenges you faced in the project




    • a statement of assistance that states if you received significant help from a tutor or class mate or outside sources and includes citations of used sources





  • Submit your files to Blackboard





    • Submit the read me and .py file




    • Filenames should include your student ID






Oct 20, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here