From d7975d8d766d5a5e1d1ebffd8a6c7e51f8ad6cbc Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Mon, 5 Feb 2024 19:03:05 +0100 Subject: [PATCH] WebAdmin: add expired to the status in users page Signed-off-by: Nicola Murino --- static/locales/en/translation.json | 3 ++- static/locales/it/translation.json | 3 ++- templates/webadmin/users.html | 12 ++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/static/locales/en/translation.json b/static/locales/en/translation.json index 9bc311ce..e21d9bc3 100644 --- a/static/locales/en/translation.json +++ b/static/locales/en/translation.json @@ -259,7 +259,8 @@ "day_of_week": "Day of week", "day_of_month": "Day of month", "month": "Month", - "options": "Options" + "options": "Options", + "expired": "Expired" }, "fs": { "view_file": "View file \"{{- path}}\"", diff --git a/static/locales/it/translation.json b/static/locales/it/translation.json index e51399d4..349f7f8c 100644 --- a/static/locales/it/translation.json +++ b/static/locales/it/translation.json @@ -259,7 +259,8 @@ "day_of_week": "Giorno settimana", "day_of_month": "Giorno mese", "month": "Mese", - "options": "Opzioni" + "options": "Opzioni", + "expired": "Scaduto" }, "fs": { "view_file": "Visualizza file \"{{- path}}\"", diff --git a/templates/webadmin/users.html b/templates/webadmin/users.html index 43e049f0..78df17f7 100644 --- a/templates/webadmin/users.html +++ b/templates/webadmin/users.html @@ -267,15 +267,23 @@ explicit grant from the SFTPGo Team (support@sftpgo.com). { data: "status", render: function(data, type, row) { + let result = data; + if (row.expiration_date){ + if (row.expiration_date < Date.now()){ + result = -1; + } + } if (type === 'display') { - switch (data){ + switch (result){ case 1: return $.t('general.active'); + case -1: + return $.t('general.expired'); default: return $.t('general.inactive'); } } - return data; + return result; } }, {