data-scientist-ml1 / auth_session_django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rate-Limiting Login Attempts in Django with Custom Session Authentication

This is a Django project built with Python 3.9.

Installation

  1. Clone the repository:
git clone https://github.com/amir-shehzad/auth_session_django.git
  1. Create a virtual environment and activate it:
python3 -m venv env
source env/bin/activate  # for Linux/Mac
env\Scripts\activate  # for Windows
  1. Install the required packages:
pip install -r requirements.txt

Superuser Account

A superuser account has already been created for this Django project. You can use the following credentials to access the admin panel:

{
    "username": "aamir",
    "password": "shehzad"
}

To log in as the superuser, run the Django development server:

python manage.py runserver

Then, visit http://localhost:8000/admin in your web browser and log in with the provided superuser credentials.

URLs

  • Login URL (POST): http://localhost:8000/login

    • Expects username and password in the request body.
  • Authenticated URL (GET): http://localhost:8000/authenticated

    • Requires session_id for authentication. Accessible only to logged-in users.
  • Reset Sessions URL (DELETE): http://localhost:8000/reset_sessions

    • For demo, this doesn't require authentication. Deletes all user sessions and logs users out.

Contributing

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

License

This project is licensed under the MIT License.

About


Languages

Language:Python 100.0%