This project implements a password reset feature with both backend and frontend components.
The backend is built with Django and Django Rest Framework.
APIs:
POST /api/v1/user/password-reset/:- This endpoint initiates the password reset process.
- It expects an
emailin the request body. - If the user exists, it sends an email with a password reset link.
POST /api/v1/user/reset-password/<encoded_pk>/<token>/:- This endpoint resets the password.
- It expects
password,confirm_password,encoded_pk, andtokenin the request body. - It validates the token and resets the password.
Setup:
- Install dependencies:
pip install -r backend/requirements.txt
- Configure email settings:
- Update your
backend/backend/settings.pywith your email provider's settings (e.g., SMTP server, username, password).
- Update your
- Run migrations:
python backend/manage.py migrate
- Run the development server:
python backend/manage.py runserver
The frontend consists of two HTML files that use JavaScript to interact with the backend APIs.
forgot-password.html:- A form to enter an email address to receive a password reset link.
reset-password.html:- A form to enter and confirm a new password.
Usage:
- Open
forgot-password.htmlin your browser. - Enter your email and submit the form.
- Check your email for the reset link.
- Open the link, which will take you to
reset-password.html. - Enter your new password and submit the form.