Skip to content

Commit

Permalink
Merge pull request #500 from intuitem/resend_mail
Browse files Browse the repository at this point in the history
Resend welcome or reset mail
  • Loading branch information
eric-intuitem authored May 30, 2024
2 parents 982cf1c + 566b6cd commit 39cdc75
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions backend/core/management/commands/reset_mail.py
Original file line number Diff line number Diff line change
@@ -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")
20 changes: 20 additions & 0 deletions backend/core/management/commands/welcome_mail.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 39cdc75

Please sign in to comment.