11from django .conf import settings
2- from django .core .mail import send_mail
32from django .core .signing import TimestampSigner
43from django .db .models .signals import post_save
54from django .dispatch import receiver
@@ -16,26 +15,27 @@ def create_profile_and_send_email(sender, instance, created, **kwargs):
1615 Profile .objects .get_or_create (user = instance )
1716
1817 # Generate a signed token for deletion link
19- token = signer .sign (instance .pk ) # securely signs user ID with timestamp
18+ # token = signer.sign(instance.pk) # securely signs user ID with timestamp
2019
2120 # Build delete URL
22- delete_url = f"{ settings .BASE_URL } /api/delete-account/?token={ token } "
23-
21+ # delete_url = f"{settings.BASE_URL}/api/delete-account/?token={token}"
22+ print ( "Profile created for user:" , instance . username )
2423 # Send confirmation mail
25- try :
26- send_mail (
27- subject = "Welcome to Our RO Purifier App 🎉" ,
28- message = (
29- f"Hi { instance .username } ,\n \n "
30- f"Your account has been created successfully.\n "
31- f"If you did NOT create this account, click below to delete it:\n "
32- f"{ delete_url } \n \n "
33- f"This link is valid for 24 hours."
34- ),
35- from_email = settings .DEFAULT_FROM_EMAIL ,
36- recipient_list = [instance .email ],
37- fail_silently = False ,
38- )
39- except Exception as e :
40- # Even if mail sending fails, the profile remains
41- print (f"⚠️ Failed to send welcome email: { e } " )
24+ # try:
25+ # # send_mail(
26+ # # subject="Welcome to Our RO Purifier App 🎉",
27+ # # message=(
28+ # # f"Hi {instance.username},\n\n"
29+ # # f"Your account has been created successfully.\n"
30+ # # f"If you did NOT create this account,
31+ # # f"click below to delete it:\n"
32+ # # f"{delete_url}\n\n"
33+ # # f"This link is valid for 24 hours."
34+ # # ),
35+ # # from_email=settings.DEFAULT_FROM_EMAIL,
36+ # # recipient_list=[instance.email],
37+ # # fail_silently=False,
38+ # # )
39+ # except Exception as e:
40+ # # Even if mail sending fails, the profile remains
41+ # print(f"⚠️ Failed to send welcome email: {e}")
0 commit comments