This project provides a comprehensive user authentication and management system, consisting of three main Python files: main.py, server.py, and client.py. The system supports user registration, login, and account deletion, while ensuring secure password storage using bcrypt hashing. Additionally, the project includes a JSON file (data.json) to store user data.
- main.py: A command-line interface (CLI) application that allows users to register, log in, and delete their accounts. The application uses the- questionarylibrary to create interactive prompts and the- bcryptlibrary to securely hash and verify passwords.
- server.py: A FastAPI-based server that exposes RESTful endpoints for user registration, login, and account deletion. The server also utilizes- bcryptfor password hashing and verification, and stores user data in a JSON file.
- client.py: A client application that interacts with the FastAPI server using the- requestslibrary. The client demonstrates how to register, log in, and delete user accounts by sending HTTP requests to the server's endpoints.
- User registration with password validation (minimum length, uppercase, lowercase, and numeric character requirements) and email validation.
- Secure password storage using bcrypt hashing.
- User login with case-insensitive username support.
- Account deletion for registered users.
- JSON-based data storage for user information.
- Python 3.6 or newer
- uvicorn(for running the FastAPI server)
- fastapi
- bcrypt
- questionary(for the CLI application)
- requests(for the client application)
- Install the required packages:
pip install uvicorn fastapi bcrypt questionary requests- Run the FastAPI server:
python server.pyThe server will start listening on http://localhost:8000.
- Use the CLI application (main.py) to use auth locally and the client (client.py) to interact with the server.
- The CLI application (main.py) can be run independently of the server and uses its own instance of the JSON data file.
- The client application (client.py) communicates with the server (server.py) and shares the same JSON data file as the server.
