mail sent from django.core.mail import EmailMessage from django.template.loader import render_to_string from threading import Thread def send_email_threaded(otp, recipient_email): """Helper function to send email asynchronously in a separate thread.""" try: # Render the HTML template with the OTP html_content = render_to_string( 'otp_email_template.html', {'otp': otp} ) # Create the email object email = EmailMessage( subject="Your OTP for Login", # Email subject body=html_content, # HTML content for the email ...
from django.shortcuts import render,redirect class SessionAuthenticationMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): print(f"Request path: {request.path}, Session key: {request.session.get('session_key')}") print("Middleware executed") # Debugging line session_key = request.session.get('session_key') if not session_key: print("Session key missing, redirecting...") # Debugging line # Allow access to the login page (which is at '/') and the signup page (which is at '/signup') ...
Comments
Post a Comment