This repository contains code for an authentication system built using Django. The system allows users to sign up, log in, log out, and reset their passwords. It also includes an account activation feature via email confirmation.
Key Features:
- User registration with email verification
- Login and logout functionality
- Password reset via email
- Account activation through email confirmation
- User interface templates for registration, login, password reset, and account activation
The project utilizes Django's built-in authentication system, including user models, login views, password reset functionality, and token generation. It incorporates email sending capabilities for account verification and password reset. The code is structured into views and templates for seamless integration into a Django project.
Technologies used: Django, HTML, CSS, JavaScript.
✨ To use it, you need to complete the following steps:
-
Clone this repository
git clone https://github.com/lazycatcoder/django-authentication-system.git
-
Open a terminal and navigate to the project 'authentication-system-django' folder
cd path/.../authentication-system-django
-
Create a virtual environment in the 'authentication-system-django' folder
python -m venv venv
-
Activate the virtual environment
source venv/bin/activate # MacOS/Linux venv\Scripts\activate # Windows
-
Install the following dependencies
pip install Django==4.2.1 pip install six==1.16.0
-
Use the console to navigate to the 'authentication-system-django\lss' folder
cd lss
-
Make migration
python manage.py makemigrations python manage.py migrate
-
Сollect static files
python manage.py collectstatic
-
Navigate to folder 'authentication-system-django\lss\lss' and open the settings.py file.
The next step is to fill in some data in settings.py:
-
Generating a new SECRET_KEY in Django
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
This command will execute a Python script that imports the get_random_secret_key() function and calls it to generate a new key. The result will be printed in the terminal.
When you get the new key, copy it and paste it into settings.py instead of SECRET_KEY = ' ''
- Navigate to the 'authentication-system-django\lss\lss' folder, open the info.py file and paste your Email and App password
EMAIL_HOST_USER = 'youremail@gmail.com'
EMAIL_HOST_PASSWORD = 'yourpassword'
DEFAULT_FROM_EMAIL = 'youremail@gmail.com'
You can get the app password in your Google account: https://myaccount.google.com/apppasswords
- Use the console to navigate to the 'authentication-system-django\lss' folder and run the server
python manage.py runserver
- Open a browser and enter the following address to launch the project http://127.0.0.1:8000/ 🚀