Academic project developed as part of the Certificate IV in Information Technology at TAFE NSW (Sydney, Australia).
A console-based login application built in Python that handles user registration, authentication and account display β storing credentials in a text file.
Unit assessed: ICTPRG302 β Apply Introductory Programming Techniques
The application simulates a simple login system with three components as per the client requirements from Gelos Enterprises:
- Component 1 β New user registration
- Component 2 β User login and authentication
- Component 3 β Display existing user accounts
- Register a new user with username and password
- Password validation β minimum length of 10 characters
- Login authentication by comparing input against stored credentials
- Display all registered usernames (without passwords)
- Persistent data storage using a text file (
accounts.txt) - Recursive input handling for invalid entries
| File | Description |
|---|---|
login_app.py |
Main Python application β all three components |
accounts.txt |
Text file storing registered usernames and passwords |
--Main Menu--
Type 1 for New Registration
Type 2 for Login
Type 3 for Exit
Registration: User enters a username and password (min. 10 characters) β saved to accounts.txt as username,password
Login: User enters credentials β compared line by line with accounts.txt β displays all usernames if successful
Display Users: Lists all registered usernames and total count
# File write β append new user
myfile = open("accounts.txt", "a")
myfile.write(f"{username},{password}\n")
# File read β authenticate user
lines = myfile.read().splitlines()
for line in lines:
words = line.split(",")
if words[0] == username and password == words[1]:
print("Correctly Username and Password!!")Concepts applied:
- Functions (
def) - File I/O (
open,read,write,splitlines,split) - Input validation (
len) - Loops (
for) - Conditionals (
if/elif/else) - Recursion for invalid input handling
- String formatting (f-strings)
sys.exit()for clean program termination
- Python 3
- File I/O (text file as data store)
- Console-based UI
python login_app.pyMake sure accounts.txt exists in the same directory before running.
Completed as Assessment Event 2 of 3 for the unit ICTPRG302 β Certificate III in Information Technology at TAFE NSW, Sydney, Australia (2024).
Julio Cesar da Silva Filho | LinkedIn