Ver código fonte

WebAdmin: add expired to the status in users page

Signed-off-by: Nicola Murino <[email protected]>
Nicola Murino 1 ano atrás
pai
commit
d7975d8d76

+ 2 - 1
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}}\"",

+ 2 - 1
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}}\"",

+ 10 - 2
templates/webadmin/users.html

@@ -267,15 +267,23 @@ explicit grant from the SFTPGo Team ([email protected]).
                     {
                         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;
                         }
                     },
                     {