From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-comp 1/1] user panel: update user expiration only if it changed
Date: Wed, 26 Nov 2025 14:51:13 +0100 [thread overview]
Message-ID: <20251126135114.235158-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251126135114.235158-1-s.sterz@proxmox.com>
otherwise users cannot edit their own account at all if they don't
have sufficient permissions to adjust the expiration date, as it will
always be send to the api. no matter whether it actually changed or
not.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/user_panel.rs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/user_panel.rs b/src/user_panel.rs
index 4950a2f..d364df8 100644
--- a/src/user_panel.rs
+++ b/src/user_panel.rs
@@ -69,11 +69,13 @@ async fn create_user(form_ctx: FormContext) -> Result<(), Error> {
async fn update_user(form_ctx: FormContext) -> Result<(), Error> {
let mut data = form_ctx.get_submit_data();
- let expire = form_ctx.read().get_field_text("expire");
- if let Ok(epoch) = proxmox_time::parse_rfc3339(&expire) {
- data["expire"] = epoch.into();
- } else {
- data["expire"] = 0i64.into();
+ if Some(true) == form_ctx.read().is_field_dirty("expire") {
+ let expire = form_ctx.read().get_field_text("expire");
+ if let Ok(epoch) = proxmox_time::parse_rfc3339(&expire) {
+ data["expire"] = epoch.into();
+ } else {
+ data["expire"] = 0i64.into();
+ }
}
let data = delete_empty_values(&data, &["firstname", "lastname", "email", "comment"], true);
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
prev parent reply other threads:[~2025-11-26 13:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 13:51 [pdm-devel] [PATCH yew-comp/yew-widget-toolkit 0/2] fix user self-editing Shannon Sterz
2025-11-26 13:51 ` [pdm-devel] [PATCH yew-widget-toolkit 1/1] form context: add method to check dirtiness of single fields Shannon Sterz
2025-11-26 13:51 ` Shannon Sterz [this message]
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=20251126135114.235158-3-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pdm-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.