Added main python code and README file.

This commit is contained in:
Ray 2022-09-18 14:03:51 +10:00
commit 1cd047520d
2 changed files with 85 additions and 0 deletions

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# SimpleLogin
A python program I made as part of an assignment while studying at TAFE NSW.
This program is designed to act as a simple login prompt with the ability to tempoarily append new credentials to the master database of credentials and list them.
All logins are fictional and do not actually login to anywhere.
© Rayyan Hodges, TAFE NSW, Gelos Enterprises, 2022
# Demos
- Registering a new user account
https://user-images.githubusercontent.com/11124303/190591344-a5a07975-a516-44e5-8691-fad88a42cdab.mp4
- Listing account credentials stored in the array
https://user-images.githubusercontent.com/11124303/190591584-4f051eb0-dd68-446d-b3b3-75edfc4ef7ea.mp4
- Logging into an existing user
https://user-images.githubusercontent.com/11124303/190591677-41b7f5ae-b776-4f2a-a69c-8f758409163c.mp4

61
SimpleLogin.py Normal file
View File

@ -0,0 +1,61 @@
# © Rayyan Hodges, TAFE NSW, Gelos Enterprises 2022
# This program is coded in Python and designed to provide a simple login system with the ability to append to accounts and a simple menu.
import time
# Defining User Credentials within a Database
user_list = {
"fredsmart1":"12345678",
"jrobertson4":"r@=%8(_W=1",
"bob101":"1234598",
"popeyedd" : "1989eidjce",
"junkman00": "p3*(kd8&ld",
"sbj2021" : "$d5e(ep2(d",
"robotman" : "7777Spy007",
"bob101":"1234598",
}
active = True
while active == True:
#Main menu which provides options to register a new account or use an existing one to sign in.
print("Welcome to Gelos Enterprises.")
menu_prompt=input("You have reached the main menu, please select from the following options: \n 'A' to login using existing credentials \n 'B' to create new credentials. \n ADMIN ONLY: Type C to list out the user database \n Please make a selection: \n ")
if menu_prompt == 'A' or menu_prompt == 'a':
# Grabbing user credentials for an existing user
Username = input("Please enter your username: \n")
Password = input("Please enter your password: \n")
key_list = list(user_list.keys())
for key in key_list:
if Username == key and Password == user_list[key]:
print("User details confirmed, opening files.")
active = False
# Registering new user credentials and appending them to the user list.
elif menu_prompt == 'B' or menu_prompt == 'b':
newuser = input("Please enter the new employee's username: \n ")
newpass = input("Please enter the new user's password: \n")
user_list[newuser] = newpass
print("User credentials added, please login with the new credentials to access the document.")
print("Returning to main menu.")
# Displaying list of user logins (presuming an admin is using this program.)
if menu_prompt == 'C' or menu_prompt == 'c':
print("Loading user credential list:")
print(user_list)
print("Returning to main menu.")
time.sleep(2)