Fullstack Fruit & Veg Shop: A web application developed with HTML, CSS, and JavaScript for the frontend, and Django for the backend. Features include user authentication, a product catalogue, shopping cart functionality, and order management. and much more
Add email verification and email handling functions
Implement verify_email_token in views.py within the authentication module to manage the email verification process:
Validate the token against the user’s record and handle different scenarios:
Check if the user exists with the provided username.
Manage cases where the user is already logged in and attempts to verify email again.
Validate the token, including checks for expiration and validity.
Resend a new verification token if the original token has expired.
Mark the email as verified if the token is valid and not expired.
Provide user feedback via messages and logging for various verification outcomes.
Include error handling to capture and log issues during the verification process.
Extract the functionality for sending email in register view function inside authentication/views.py:
Extracted the logic from the register function in views.py and placed it into views_helper.py with the name send_verification_email.
Implemented send_verification_email to handle different types of emails (e.g., forgotten password, email notification) based on function parameters and send-type.
Updated email handling with improved subject lines and follow-up messages.
Enhanced logging for email-related actions to track verification attempts and issues.
Create send_emails_type in the utils folder within the authentication module:
This new module contains a list of functions for sending various types of emails, used in conjunction with send_verification_email.
Ensure correct functionality:
Verified that the function sends emails to the user’s email address and handles different types of token validation (e.g., invalid token).
TODO:
Add a spinner to the registration button to indicate that an action is in progress.
Implement a login functionality for users to log in with their registered password.
Add email verification and email handling functions
Implement
verify_email_token
inviews.py
within theauthentication
module to manage the email verification process:Extract the functionality for sending email in
register
view function insideauthentication/views.py
:register
function inviews.py
and placed it intoviews_helper.py
with the namesend_verification_email
.send_verification_email
to handle different types of emails (e.g., forgotten password, email notification) based on function parameters and send-type.Create
send_emails_type
in theutils
folder within theauthentication
module:send_verification_email
.Ensure correct functionality:
TODO: