Skip to content

Commit bad165e

Browse files
committed
Day 10: Disable Email setting
1 parent 6b299a8 commit bad165e

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

backend/settings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@
148148
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
149149

150150

151-
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
152-
EMAIL_HOST = config("EMAIL_HOST", default="smtp.gmail.com")
153-
EMAIL_USE_TLS = True
154-
EMAIL_PORT = config("EMAIL_PORT")
155-
EMAIL_HOST_USER = config("EMAIL_HOST_USER")
156-
EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD")
151+
# EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
152+
# EMAIL_HOST = config("EMAIL_HOST", default="smtp.gmail.com")
153+
# EMAIL_USE_TLS = True
154+
# EMAIL_PORT = config("EMAIL_PORT")
155+
# EMAIL_HOST_USER = config("EMAIL_HOST_USER")
156+
# EMAIL_HOST_PASSWORD = config("EMAIL_HOST_PASSWORD")
157157

158158

159159
REST_FRAMEWORK = {

users/signals.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from django.conf import settings
2-
from django.core.mail import send_mail
32
from django.core.signing import TimestampSigner
43
from django.db.models.signals import post_save
54
from 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

Comments
 (0)