mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-05 17:30:30 +00:00
feat(authentication): 用户重置密码成功后,发送用户重置密码成功邮件
This commit is contained in:
@@ -13,7 +13,7 @@ from django.core.cache import cache
|
||||
from datetime import datetime
|
||||
|
||||
from common.tasks import send_mail_async
|
||||
from common.utils import reverse, get_object_or_none
|
||||
from common.utils import reverse, get_object_or_none, get_request_ip_or_data, get_request_user_agent
|
||||
from .models import User
|
||||
|
||||
|
||||
@@ -112,6 +112,45 @@ def send_reset_password_mail(user):
|
||||
send_mail_async.delay(subject, message, recipient_list, html_message=message)
|
||||
|
||||
|
||||
def send_reset_password_success_mail(request, user):
|
||||
subject = _('Reset password success')
|
||||
recipient_list = [user.email]
|
||||
message = _("""
|
||||
|
||||
Hi %(name)s:
|
||||
<br>
|
||||
|
||||
|
||||
<br>
|
||||
Your JumpServer password has just been successfully updated.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
If the password update was not initiated by you, your account may have security issues.
|
||||
It is recommended that you log on to the JumpServer immediately and change your password.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
If you have any questions, you can contact the administrator.
|
||||
<br>
|
||||
<br>
|
||||
---
|
||||
<br>
|
||||
<br>
|
||||
IP Address: %(ip_address)s
|
||||
<br>
|
||||
<br>
|
||||
Browser: %(browser)s
|
||||
<br>
|
||||
|
||||
""") % {
|
||||
'name': user.name,
|
||||
'ip_address': get_request_ip_or_data(request),
|
||||
'browser': get_request_user_agent(request),
|
||||
}
|
||||
send_mail_async.delay(subject, message, recipient_list, html_message=message)
|
||||
|
||||
|
||||
def send_password_expiration_reminder_mail(user):
|
||||
subject = _('Security notice')
|
||||
recipient_list = [user.email]
|
||||
|
Reference in New Issue
Block a user