[pdm-devel] [PATCH yew-comp 1/1] user panel: update user expiration only if it changed

Shannon Sterz s.sterz at proxmox.com
Wed Nov 26 14:51:13 CET 2025


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 at 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





More information about the pdm-devel mailing list