remove email related code
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 9s

This commit is contained in:
2026-08-02 14:25:41 +05:00
parent 6cdf042f49
commit 00d25698c6
12 changed files with 30 additions and 199 deletions
-45
View File
@@ -1,8 +1,4 @@
from django.core.mail import EmailMultiAlternatives
from django.dispatch import receiver
from django.template.loader import render_to_string
from decouple import config
from django_rest_passwordreset.signals import reset_password_token_created
from django.db.models.signals import post_save
from api.models import User, TemporaryUser
from django.contrib.auth.models import Permission
@@ -44,44 +40,3 @@ def verify_user_with_person_api(sender, instance, created, **kwargs):
if created:
print(f"Temporary User Instance: {instance}")
verify_user_with_person_api_task(instance.t_id)
@receiver(reset_password_token_created)
def password_reset_token_created(
sender, instance, reset_password_token, *args, **kwargs
):
"""
Handles password reset tokens
When a token is created, an e-mail needs to be sent to the user
:param sender: View Class that sent the signal
:param instance: View Instance that sent the signal
:param reset_password_token: Token Model Object
:param args:
:param kwargs:
:return:
"""
context = {
"current_user": reset_password_token.user,
"username": reset_password_token.user.username,
"email": reset_password_token.user.email,
"reset_password_url": f"{config('FRONTEND_URL')}/auth/reset-password-confirm/?token={reset_password_token.key}",
}
# render email text
email_html_message = render_to_string("email/password_reset_email.html", context)
email_plaintext_message = (
f"Here is your password reset link: {context['reset_password_url']}"
)
msg = EmailMultiAlternatives(
# title:
"Password Reset for {title}".format(title="Sarlink Portal"),
# message:
email_plaintext_message, # This is the plaintext version
# from:
"noreply@sarlink.net",
# to:
[reset_password_token.user.email],
)
msg.attach_alternative(email_html_message, "text/html")
msg.send()