diff --git a/apps/i18n/lina/en.json b/apps/i18n/lina/en.json index d1c8eb869..6e635e3d1 100644 --- a/apps/i18n/lina/en.json +++ b/apps/i18n/lina/en.json @@ -1775,5 +1775,7 @@ "SdkScriptLoadFailed": "SDK script load failed, please check network or driver service", "SdkStatus": "SDK Status", "OperationUnavailableWhenMismatch": "No available actions because Ukey does not match the user", - "InfoHiddenWhenMismatch": "Certificate information is hidden because Ukey does not match the user" + "InfoHiddenWhenMismatch": "Certificate information is hidden because Ukey does not match the user", + "Days": "day", + "NotLoggedInForMoreThan": "Not logged in for more than" } diff --git a/apps/i18n/lina/es.json b/apps/i18n/lina/es.json index 791d13e5d..ca745f7b3 100644 --- a/apps/i18n/lina/es.json +++ b/apps/i18n/lina/es.json @@ -1697,5 +1697,7 @@ "ReportRecipientsTip": "Actualmente solo admite envío por correo electrónico", "ReportSchedulePriorityTip": "Si se establecen tanto el intervalo como el crontab, el crontab tiene prioridad", "FooterContentTooLong200": "El contenido del pie de página no debe exceder los 200 caracteres", - "ImageFileCorruptedOrUnreadable": "El archivo de imagen está dañado o no se puede leer. Verifica el archivo y vuelve a intentarlo." + "ImageFileCorruptedOrUnreadable": "El archivo de imagen está dañado o no se puede leer. Verifica el archivo y vuelve a intentarlo.", + "Days": "días", + "NotLoggedInForMoreThan": "No ha iniciado sesión durante más de" } diff --git a/apps/i18n/lina/ja.json b/apps/i18n/lina/ja.json index a3acd8ea8..c09b8f353 100644 --- a/apps/i18n/lina/ja.json +++ b/apps/i18n/lina/ja.json @@ -1702,5 +1702,7 @@ "ReportRecipientsTip": "現在はメール送信のみ対応しています", "ReportSchedulePriorityTip": "interval と crontab の両方が設定されている場合、crontab が優先されます", "FooterContentTooLong200": "フッターの内容は200文字を超えることはできません。", - "ImageFileCorruptedOrUnreadable": "画像ファイルが破損しているか、読み取れません。ファイルを確認して、もう一度お試しください。" + "ImageFileCorruptedOrUnreadable": "画像ファイルが破損しているか、読み取れません。ファイルを確認して、もう一度お試しください。", + "Days": "空", + "NotLoggedInForMoreThan": "ログインしていない日数が" } diff --git a/apps/i18n/lina/ko.json b/apps/i18n/lina/ko.json index 1ad516ceb..97f0f3339 100644 --- a/apps/i18n/lina/ko.json +++ b/apps/i18n/lina/ko.json @@ -1697,5 +1697,7 @@ "ReportRecipientsTip": "현재 이메일 전송만 지원합니다", "ReportSchedulePriorityTip": "interval 과 crontab 이 모두 설정된 경우 crontab 이 우선합니다", "FooterContentTooLong200": "바닥글 내용은 200자를 초과할 수 없습니다.", - "ImageFileCorruptedOrUnreadable": "이미지 파일이 손상되었거나 읽을 수 없습니다. 파일을 확인한 후 다시 시도해 주세요." + "ImageFileCorruptedOrUnreadable": "이미지 파일이 손상되었거나 읽을 수 없습니다. 파일을 확인한 후 다시 시도해 주세요.", + "Days": "일 이상", + "NotLoggedInForMoreThan": "로그인하지 않은 지" } diff --git a/apps/i18n/lina/pt_br.json b/apps/i18n/lina/pt_br.json index 78f685d31..ffd59a08f 100644 --- a/apps/i18n/lina/pt_br.json +++ b/apps/i18n/lina/pt_br.json @@ -1698,5 +1698,7 @@ "ReportRecipientsTip": "Atualmente suporta apenas envio por e-mail", "ReportSchedulePriorityTip": "Se ambos, intervalo e crontab, estiverem definidos, o crontab terá prioridade", "FooterContentTooLong200": "O conteúdo do rodapé não pode exceder 200 caracteres.", - "ImageFileCorruptedOrUnreadable": "O arquivo de imagem está corrompido ou não pode ser lido. Verifique o arquivo e tente novamente." + "ImageFileCorruptedOrUnreadable": "O arquivo de imagem está corrompido ou não pode ser lido. Verifique o arquivo e tente novamente.", + "Days": "dias", + "NotLoggedInForMoreThan": "Não fez login por mais de" } diff --git a/apps/i18n/lina/ru.json b/apps/i18n/lina/ru.json index 8789f0f21..9fc3f8674 100644 --- a/apps/i18n/lina/ru.json +++ b/apps/i18n/lina/ru.json @@ -1697,5 +1697,7 @@ "ReportRecipientsTip": "В настоящее время поддерживается только отправка по электронной почте", "ReportSchedulePriorityTip": "Если установлены и интервал, и crontab, приоритет отдается crontab", "FooterContentTooLong200": "Содержание нижнего колонтитула не может превышать 200 символов", - "ImageFileCorruptedOrUnreadable": "Файл изображения повреждён или не может быть прочитан. Пожалуйста, проверьте файл и попробуйте снова." + "ImageFileCorruptedOrUnreadable": "Файл изображения повреждён или не может быть прочитан. Пожалуйста, проверьте файл и попробуйте снова.", + "Days": "дней", + "NotLoggedInForMoreThan": "Не входил более" } diff --git a/apps/i18n/lina/vi.json b/apps/i18n/lina/vi.json index 0bac3a037..a69b153f0 100644 --- a/apps/i18n/lina/vi.json +++ b/apps/i18n/lina/vi.json @@ -1697,5 +1697,7 @@ "ReportRecipientsTip": "Hiện tại chỉ hỗ trợ gửi qua email", "ReportSchedulePriorityTip": "Nếu cả interval và crontab đều được đặt, crontab sẽ được ưu tiên", "FooterContentTooLong200": "Nội dung chân trang quá dài, vui lòng nhập nội dung dưới 200 ký tự", - "ImageFileCorruptedOrUnreadable": "Tệp hình ảnh đã bị hỏng hoặc không thể đọc được. Vui lòng kiểm tra tệp và thử lại." + "ImageFileCorruptedOrUnreadable": "Tệp hình ảnh đã bị hỏng hoặc không thể đọc được. Vui lòng kiểm tra tệp và thử lại.", + "Days": "ngày", + "NotLoggedInForMoreThan": "Không đăng nhập quá" } diff --git a/apps/i18n/lina/zh.json b/apps/i18n/lina/zh.json index b35acd637..90f711aa2 100644 --- a/apps/i18n/lina/zh.json +++ b/apps/i18n/lina/zh.json @@ -1786,5 +1786,7 @@ "SdkScriptLoadFailed": "驱动脚本加载失败,请检查网络或驱动服务", "SdkStatus": "SDK 状态", "OperationUnavailableWhenMismatch": "Ukey 与用户不匹配没有操作可用", - "InfoHiddenWhenMismatch": "Ukey 与用户不匹配不显示证书信息" + "InfoHiddenWhenMismatch": "Ukey 与用户不匹配不显示证书信息", + "Days": "天", + "NotLoggedInForMoreThan": "未登录超过" } diff --git a/apps/i18n/lina/zh_hant.json b/apps/i18n/lina/zh_hant.json index 98c2dd5eb..4dc65027f 100644 --- a/apps/i18n/lina/zh_hant.json +++ b/apps/i18n/lina/zh_hant.json @@ -1747,5 +1747,7 @@ "SdkScriptLoadFailed": "驅動腳本載入失敗,請檢查網路或驅動服務", "SdkStatus": "SDK 狀態", "OperationUnavailableWhenMismatch": "因為 Ukey 與用戶不匹配,無可用操作", - "InfoHiddenWhenMismatch": "因為 Ukey 與用戶不匹配,證書資訊被隱藏" + "InfoHiddenWhenMismatch": "因為 Ukey 與用戶不匹配,證書資訊被隱藏", + "Days": "天", + "NotLoggedInForMoreThan": "未登入超過" } diff --git a/apps/users/filters.py b/apps/users/filters.py index 5552ad94b..0ad63d33f 100644 --- a/apps/users/filters.py +++ b/apps/users/filters.py @@ -71,20 +71,16 @@ class UserFilter(BaseFilterSet): return queryset.filter(q) def filter_long_time(self, queryset, name, value): - now = timezone.now() - interval = 30 - date_expired = now - timezone.timedelta(days=int(interval)) - if name == 'is_long_time_no_login': - key = 'last_login' - else: - raise ValueError('Invalid filter name') + if not value: + return queryset - if value: - kwargs = {f'{key}__lt': date_expired} - else: - kwargs = {f'{key}__gt': date_expired} - q = Q(**kwargs) | Q(**{f'{key}__isnull': True}) - return queryset.filter(q) + no_login_days = self.request.GET.get('no_login_days', 30) + cutoff_time = timezone.now() - timezone.timedelta(days=int(no_login_days)) + + return queryset.filter( + Q(last_login__lt=cutoff_time) | + Q(last_login__isnull=True) + ) def filter_is_valid(self, queryset, name, value): if value: