From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 76A0BDDC2 for ; Fri, 22 Sep 2023 16:37:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3C412BCB8 for ; Fri, 22 Sep 2023 16:37:05 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 22 Sep 2023 16:37:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BD61348853 for ; Fri, 22 Sep 2023 16:37:03 +0200 (CEST) From: Philipp Hufnagl To: pve-devel@lists.proxmox.com Date: Fri, 22 Sep 2023 16:36:55 +0200 Message-Id: <20230922143658.1639173-2-p.hufnagl@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230922143658.1639173-1-p.hufnagl@proxmox.com> References: <20230922143658.1639173-1-p.hufnagl@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.627 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record TVD_PH_SUBJ_META1 1.249 Email has a Phishy looking subject line Subject: [pve-devel] [PATCH manager v1 1/1] fix #4546: ui: notify user if their user account expires soon X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2023 14:37:05 -0000 When the user account that is currently logged in will expire soon, the user icon will turn into a yellow exclamation mark. In the user menu there will be a new element informing the user briefly about it. If the element is clicked, a popup will appear informing the user in detail about it Signed-off-by: Philipp Hufnagl --- www/manager6/Workspace.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js index 18d574b7..9d166493 100644 --- a/www/manager6/Workspace.js +++ b/www/manager6/Workspace.js @@ -42,6 +42,7 @@ Ext.define('PVE.Workspace', { Proxmox.Utils.authClear(); Ext.state.Manager.clear('GuiCap'); Proxmox.UserName = null; + Proxmox.UserExpires = null; me.loginData = null; if (!me.login) { @@ -198,6 +199,18 @@ Ext.define('PVE.StdWorkspace', { let me = this; let ui = me.query('#userinfo')[0]; ui.setText(Ext.String.htmlEncode(Proxmox.UserName || '')); + let label = me.query('#expirewarning')[0]; + if (Proxmox.UserExpires !== null) { + let expieWariningThreshold = Ext.Date.add(new Date(), Ext.Date.DAY, 7); + let expireDate = new Date(Proxmox.UserExpires * 1000); + if (expieWariningThreshold >= expireDate) { + ui.setIconCls('fa fa-exclamation-triangle warning'); + label.setHidden(false); + } + } else { + label.setHidden(true); + ui.setIconCls('fa fa-user'); + } ui.updateLayout(); }, @@ -367,6 +380,21 @@ Ext.define('PVE.StdWorkspace', { }, iconCls: 'fa fa-user', menu: [ + { + iconCls: 'fa fa-exclamation-triangle warning', + itemId: 'expirewarning', + text: gettext('Account expiring soon!'), + hidden: true, + handler: function() { + let expireDate = new Date(Proxmox.UserExpires * 1000); + Ext.Msg.show({ + title: gettext('Account expiring soon!'), + icon: Ext.Msg.WARNING, + message: Ext.String.format(gettext("Your account is expiring on {0} . After that you won't be able to log in!"), expireDate), + buttons: Ext.Msg.OK, + }); + }, + }, { iconCls: 'fa fa-gear', text: gettext('My Settings'), -- 2.39.2