/User-Auth-Django-React-2024

This is a user authentication project with login and logout features. The back-end is Django while the Front-end is React

Primary LanguagePython

Advanced User Authentication System

This project implements a sophisticated user authentication system using Django as the backend and React as the frontend. It includes features like user roles, permissions, JWT-based authentication, email verification, password reset, and user profile management. The frontend state is managed using Redux, providing a scalable and maintainable solution.

Features

  • User Authentication: Secure login and registration functionalities.
  • User Roles: Define roles for users (admin, user) with corresponding permissions.
  • JWT Authentication: JSON Web Tokens for secure authentication.
  • Email Verification: Verify user email addresses during registration.
  • Password Reset: Allow users to reset their passwords via email.
  • User Profile Management: Enable users to update their personal information.

Technologies Used

Backend

  • Django: Python-based web framework for building the backend.
  • Django Rest Framework (DRF): Toolkit for building RESTful APIs with Django.
  • Django Rest Framework Simple JWT: Provides JWT authentication for DRF.
  • django-cors-headers: Handles Cross-Origin Resource Sharing (CORS) in Django.

Frontend

  • React: JavaScript library for building user interfaces.
  • Redux: State management library for managing application state.
  • React Router: Declarative routing for React applications.
  • Axios: Promise-based HTTP client for making AJAX requests.

Getting Started

Prerequisites

  • Python: Install Python from python.org.
  • Node.js: Install Node.js from nodejs.org.
  • npm: Node.js package manager, included with Node.js installation.
  • Git: Install Git from git-scm.com.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/advanced-user-authentication.git
    cd advanced-user-authentication
  2. Set up the Django backend:

    cd backend
    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    pip install -r requirements.txt
    python manage.py migrate
    python manage.py createsuperuser
    python manage.py runserver
  3. Set up the React frontend:

    cd ../frontend
    npm install
    npm start
  4. Open your browser and navigate to http://localhost:3000 to access the application.

Usage

  • Register a new user: Navigate to /register and fill out the registration form.
  • Log in: Navigate to /login and enter your credentials.
  • Access user profile: Once logged in, you can access and update your profile information.
  • Manage users (admin only): Admin users can manage other users, including assigning roles and permissions.

Contributing

Contributions are welcome! If you have any ideas for improvements or feature suggestions, please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements