mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-16 07:18:22 +00:00
perf: Add last login date update for account on session save
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from simple_history.models import HistoricalRecords
|
||||
|
||||
@@ -167,6 +168,10 @@ class Account(AbsConnectivity, LabeledMixin, BaseAccount):
|
||||
|
||||
return escape(value)
|
||||
|
||||
def update_last_login_date(self):
|
||||
self.date_last_login = timezone.now()
|
||||
self.save(update_fields=['date_last_login'])
|
||||
|
||||
|
||||
def replace_history_model_with_mixin():
|
||||
"""
|
||||
|
Reference in New Issue
Block a user