Skip to content

This project demonstrates the implementation of a simple user registration, login, and account removal system using Python 3.11 with a MySQL/MariaDB database. The system uses Object-Oriented Programming (OOP) principles and the MVC (Model-View-Controller) architecture. It utilizes the SQLAlchemy ORM to interact with the database...

Notifications You must be signed in to change notification settings

ecopque/registration_and_login_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Registration and Login Project

This project demonstrates the implementation of a simple user registration, login, and account removal system using Python 3.11 with a MySQL/MariaDB database. The system uses Object-Oriented Programming (OOP) principles and the MVC (Model-View-Controller) architecture. It utilizes the SQLAlchemy ORM to interact with the database, ensuring modularity and code reuse.

Technologies Used

  • Python 3.11: The primary programming language.
  • MySQL / MariaDB: The relational database system used to store user data.
  • SQLAlchemy: An Object-Relational Mapper (ORM) for managing database interactions.
  • PyMySQL: A library used by SQLAlchemy to interact with MySQL/MariaDB databases.
  • MVC Architecture: The project follows the Model-View-Controller design pattern for better organization and separation of concerns.

Database Setup

  1. MySQL/MariaDB:

    • Ensure MySQL/MariaDB is installed on your machine.
    • Create the database with the following command:
      CREATE DATABASE registration_and_login;
  2. Install Dependencies:

    • Install the required libraries using pip:
      pip install sqlalchemy pymysql

Project Structure

  1. model.py:

    • Defines the database structure and ORM mappings using SQLAlchemy.
    • Contains the Person class, representing user data in the database.
  2. controller.py:

    • Contains the RegisterController, LoginController, and RemoveController classes responsible for handling user registration, login, and account removal.
    • The controllers interact with the database through the SQLAlchemy session to perform CRUD operations.
  3. view.py:

    • Acts as the user interface, providing a simple menu for the user to choose between registration, login, or account removal.
    • Collects user inputs and passes them to the appropriate controller for processing.

Database Connection Configuration

In the model.py file, update the following connection parameters to match your database setup:

USER = 'root'          # Your MySQL/MariaDB username
PASSWORD = '123456'    # Your MySQL/MariaDB password
HOST = 'localhost'     # The host where MySQL/MariaDB is running
PORT = '3306'          # The port MySQL/MariaDB is listening on
DATABASE = 'registration_and_login'  # The name of the database

Usage

  1. Running the Application

To run the application, execute view.py:

python view.py

This will present a menu where you can choose one of the following options:

1: Register a new user.
2: Login with an existing user.
3: Remove a user account.
4: Exit the application.
  1. Registration Flow

    The user will be prompted to enter a name, email, and password. The system checks the validity of the entered data (name, email, and password length validation). If the data is valid, the user is added to the person table in the database with the password hashed.

  2. Login Flow

    The user enters their email and password. The system checks if the email and password match an existing user in the database. If successful, the user is logged in.

  3. Remove Account Flow

    The user can remove their account by providing the email of the account they wish to delete. The system checks if the email exists in the database and removes the user if found.

Key Features

Data Validation: Ensures that user inputs are within acceptable limits (e.g., name, email, and password lengths).
Password Hashing: Passwords are hashed using SHA-256 before being stored in the database.
Modular Structure: The project is divided into separate files for better organization: model.py (database), controller.py (business logic), and view.py (user interface).
Session Management: SQLAlchemy is used to manage sessions and interact with the database.

Requirements

Python 3.11
MySQL or MariaDB
SQLAlchemy
PyMySQL

About

This project demonstrates the implementation of a simple user registration, login, and account removal system using Python 3.11 with a MySQL/MariaDB database. The system uses Object-Oriented Programming (OOP) principles and the MVC (Model-View-Controller) architecture. It utilizes the SQLAlchemy ORM to interact with the database...

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages