Email COnfigs & setup
This commit is contained in:
@@ -1267,16 +1267,21 @@ class AuthViewSet(viewsets.GenericViewSet):
|
||||
expires_at=expires_at
|
||||
)
|
||||
|
||||
# Send email (async via Celery if available, otherwise sync)
|
||||
# Send password reset email using the email service
|
||||
try:
|
||||
from igny8_core.modules.system.tasks import send_password_reset_email
|
||||
send_password_reset_email.delay(user.id, token)
|
||||
except:
|
||||
# Fallback to sync email sending
|
||||
from igny8_core.business.billing.services.email_service import send_password_reset_email
|
||||
send_password_reset_email(user, token)
|
||||
except Exception as e:
|
||||
# Fallback to Django's send_mail if email service fails
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.error(f"Failed to send password reset email via email service: {e}")
|
||||
|
||||
from django.core.mail import send_mail
|
||||
from django.conf import settings
|
||||
|
||||
reset_url = f"{request.scheme}://{request.get_host()}/reset-password?token={token}"
|
||||
frontend_url = getattr(settings, 'FRONTEND_URL', 'https://app.igny8.com')
|
||||
reset_url = f"{frontend_url}/reset-password?token={token}"
|
||||
|
||||
send_mail(
|
||||
subject='Reset Your IGNY8 Password',
|
||||
|
||||
Reference in New Issue
Block a user