all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Philipp Hufnagl <p.hufnagl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v1 1/1] fix #4546: ui: notify user if their user account expires soon
Date: Fri, 22 Sep 2023 16:36:55 +0200	[thread overview]
Message-ID: <20230922143658.1639173-2-p.hufnagl@proxmox.com> (raw)
In-Reply-To: <20230922143658.1639173-1-p.hufnagl@proxmox.com>

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 <p.hufnagl@proxmox.com>
---
 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





  reply	other threads:[~2023-09-22 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 14:36 [pve-devel] [PATCH manager/access-control/proxmox-widget-toolkit v1 0/4] fix #4546: Show warning hint/badge if user account is expiring in next few days Philipp Hufnagl
2023-09-22 14:36 ` Philipp Hufnagl [this message]
2023-10-06 13:16   ` [pve-devel] [PATCH manager v1 1/1] fix #4546: ui: notify user if their user account expires soon Lukas Wagner
2023-10-10 10:15     ` Philipp Hufnagl
2023-09-22 14:36 ` [pve-devel] [PATCH access-control v1 1/1] fix #4546: api: Return user expiration date on access/ticket API call Philipp Hufnagl
2023-10-06 13:16   ` Lukas Wagner
2023-09-22 14:36 ` [pve-devel] [PATCH proxmox-widget-toolkit v1 1/2] fix #4546: css: Inform user administrator about user accounts expiring soon Philipp Hufnagl
2023-10-06 13:16   ` Lukas Wagner
2023-10-06 14:41     ` Stefan Sterz
2023-10-10 10:18       ` Philipp Hufnagl
2023-09-22 14:36 ` [pve-devel] [PATCH proxmox-widget-toolkit v1 2/2] fix #4546: utils: save expiring date of user account for UI Philipp Hufnagl
2023-10-06 13:16   ` Lukas Wagner
2023-10-06 14:41   ` Stefan Sterz
2023-10-06 13:16 ` [pve-devel] [PATCH manager/access-control/proxmox-widget-toolkit v1 0/4] fix #4546: Show warning hint/badge if user account is expiring in next few days Lukas Wagner
2023-10-09 13:07   ` Philipp Hufnagl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230922143658.1639173-2-p.hufnagl@proxmox.com \
    --to=p.hufnagl@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal