mirror of https://github.com/jumpserver/jumpserver
perf: 修改默认的邮箱地址
parent
2069fee795
commit
15a5dda9e0
|
@ -37,9 +37,7 @@ def send_mail_async(*args, **kwargs):
|
||||||
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
||||||
args.insert(2, from_email)
|
args.insert(2, from_email)
|
||||||
|
|
||||||
args[3] = [mail for mail in args[3] if mail != 'admin@mycomany.com']
|
|
||||||
args = tuple(args)
|
args = tuple(args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return send_mail(*args, **kwargs)
|
return send_mail(*args, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -52,7 +50,6 @@ def send_mail_attachment_async(subject, message, recipient_list, attachment_list
|
||||||
attachment_list = []
|
attachment_list = []
|
||||||
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER
|
||||||
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
|
subject = (settings.EMAIL_SUBJECT_PREFIX or '') + subject
|
||||||
recipient_list = [mail for mail in recipient_list if mail != 'admin@mycomany.com']
|
|
||||||
email = EmailMultiAlternatives(
|
email = EmailMultiAlternatives(
|
||||||
subject=subject,
|
subject=subject,
|
||||||
body=message,
|
body=message,
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Generated by Django 4.1.10 on 2023-09-27 06:56
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_user_default_email(apps, *args):
|
||||||
|
user_cls = apps.get_model('users', 'User')
|
||||||
|
user_cls.objects\
|
||||||
|
.filter(email='admin@mycomany.com')\
|
||||||
|
.update(email='admin@example.com')
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0045_delete_usersession'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(migrate_user_default_email),
|
||||||
|
]
|
Loading…
Reference in New Issue