diff --git a/backend/core/management/commands/reset_mail.py b/backend/core/management/commands/reset_mail.py new file mode 100644 index 0000000000..2b3c24cdf0 --- /dev/null +++ b/backend/core/management/commands/reset_mail.py @@ -0,0 +1,20 @@ +from django.core.management.base import BaseCommand +from core.models import * +from iam.models import User, Folder +from ciso_assistant.settings import CISO_ASSISTANT_SUPERUSER_EMAIL + + +class Command(BaseCommand): + help = "Send reset email" + + def handle(self, *args, **kwargs): + admin = User.objects.get(email=CISO_ASSISTANT_SUPERUSER_EMAIL) + print(admin) + try: + admin.mailing( + email_template_name="registration/password_reset_email.html", + subject="CISO Assistant: Password Reset", + ) + self.stdout.write("reset mail sent") + except Exception as e: + self.stdout.write("cannot send reset mail") diff --git a/backend/core/management/commands/welcome_mail.py b/backend/core/management/commands/welcome_mail.py new file mode 100644 index 0000000000..0644f6134b --- /dev/null +++ b/backend/core/management/commands/welcome_mail.py @@ -0,0 +1,20 @@ +from django.core.management.base import BaseCommand +from core.models import * +from iam.models import User, Folder +from ciso_assistant.settings import CISO_ASSISTANT_SUPERUSER_EMAIL + + +class Command(BaseCommand): + help = "Send welcome email" + + def handle(self, *args, **kwargs): + admin = User.objects.get(email=CISO_ASSISTANT_SUPERUSER_EMAIL) + print(admin) + try: + admin.mailing( + email_template_name="registration/first_connexion_email.html", + subject="Welcome to CISO Assistant!", + ) + self.stdout.write("welcome mail sent") + except Exception as e: + self.stdout.write("cannot send welcome mail")