From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 7F3851FF09D for ; Sun, 15 Nov 2026 20:42:11 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 71F7A2177B; Sun, 15 Nov 2026 20:41:05 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v2 manager 10/19] ui: token edit: only submit the expiration date when changed Date: Sun, 15 Nov 2026 20:40:31 +0100 Message-ID: <20261115194043.3947825-11-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261115194043.3947825-1-t.lamprecht@proxmox.com> References: <20261115194043.3947825-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794771649656 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.229 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: XXFVHA5DWKTWTK6YGKNGB4DDVAFMYA7T X-Message-ID-Hash: XXFVHA5DWKTWTK6YGKNGB4DDVAFMYA7T X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The day-granular date field resubmits the stored expiration date truncated to the start of its day, so any unrelated edit, for example of the comment, silently shortened the stored date by up to a day. Drop the value from the submission if the selected day was not actually changed. Signed-off-by: Thomas Lamprecht --- changes since v1: - compute the unchanged day with Ext.Date.clearTime, like the date field www/manager6/dc/TokenEdit.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/www/manager6/dc/TokenEdit.js b/www/manager6/dc/TokenEdit.js index fc9f0cc2c..cf4e2ae2e 100644 --- a/www/manager6/dc/TokenEdit.js +++ b/www/manager6/dc/TokenEdit.js @@ -25,6 +25,20 @@ Ext.define('PVE.dc.TokenEdit', { delete values.userid; delete values.tokenid; + // the date field only holds the day, so drop an unchanged day to keep the exact stored + // expiration date + if (!win.isCreate && win.originalExpire !== undefined) { + let originalDayStart = 0; + if (win.originalExpire) { + let day = new Date(win.originalExpire * 1000); + Ext.Date.clearTime(day); + originalDayStart = Math.floor(day.getTime() / 1000); + } + if (Number(values.expire) === originalDayStart) { + delete values.expire; + } + } + win.url += `${uid}/token/${tid}`; return values; }, @@ -91,6 +105,20 @@ Ext.define('PVE.dc.TokenEdit', { }); } }, + + setValues: function (values) { + let me = this; + // remember the stored expiration date to detect a real change on submission; the + // token grid's record carries it as a Date object, the API as epoch seconds + if (!me.isCreate && values.expire !== undefined) { + me.originalExpire = + values.expire instanceof Date + ? Math.floor(values.expire.getTime() / 1000) + : Number(values.expire); + } + me.callParent([values]); + }, + apiCallDone: function (success, response, options) { let res = response.result.data; if (!success || !res.value) { -- 2.47.3