mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 06:46:24 +00:00
@@ -41,9 +41,10 @@ class UserLoginReminderMsg(UserMessage):
|
||||
class AssetLoginReminderMsg(UserMessage):
|
||||
subject = _('Asset login reminder')
|
||||
|
||||
def __init__(self, user, asset: Asset, login_user: User):
|
||||
def __init__(self, user, asset: Asset, login_user: User, account_username):
|
||||
self.asset = asset
|
||||
self.login_user = login_user
|
||||
self.account_username = account_username
|
||||
super().__init__(user)
|
||||
|
||||
def get_html_msg(self) -> dict:
|
||||
@@ -51,6 +52,7 @@ class AssetLoginReminderMsg(UserMessage):
|
||||
'recipient': self.user.username,
|
||||
'username': self.login_user.username,
|
||||
'asset': str(self.asset),
|
||||
'account': self.account_username,
|
||||
}
|
||||
message = render_to_string('acls/asset_login_reminder.html', context)
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
<hr>
|
||||
<p><strong>{% trans 'Username' %}:</strong> [{{ username }}]</p>
|
||||
<p><strong>{% trans 'Assets' %}:</strong> [{{ asset }}]</p>
|
||||
<p><strong>{% trans 'Account' %}:</strong> [{{ account }}]</p>
|
||||
<hr>
|
||||
|
||||
<p>{% trans 'The user has just successfully logged into the asset. Please ensure that this is an authorized operation. If you suspect that this is an unauthorized access, please take appropriate measures immediately.' %}</p>
|
||||
|
@@ -419,9 +419,10 @@ class ConnectionTokenViewSet(ExtraActionApiMixin, RootOrgViewMixin, JMSModelView
|
||||
reviewers = acl.reviewers.all()
|
||||
if not reviewers:
|
||||
return
|
||||
account_username = account.username
|
||||
self._record_operate_log(acl, asset)
|
||||
for reviewer in reviewers:
|
||||
AssetLoginReminderMsg(reviewer, asset, user).publish_async()
|
||||
AssetLoginReminderMsg(reviewer, asset, user, account_username).publish_async()
|
||||
|
||||
|
||||
class SuperConnectionTokenViewSet(ConnectionTokenViewSet):
|
||||
|
Reference in New Issue
Block a user