Improve double-upload detection
authorKarl O. Pinc <kop@karlpinc.com>
Tue, 16 Jul 2024 22:19:54 +0000 (17:19 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Tue, 16 Jul 2024 22:19:54 +0000 (17:19 -0500)
Goes with pgwui_core commit 6fc47ce73d.

src/pgwui_common/templates/auth_base.mak
src/pgwui_common/templates/auth_parts.mak

index 867675d227eaa3b7f23cf13f2d18bb5e0ac0c430..9f40a8cc50c06841625a82b27aa3eaa6193ef558 100644 (file)
     For use with upload_form:
     csrf_token  Token for detecting CSRF.
     report_success  Boolean. Whether to tell the user the db was changed.
+    db_changed  Boolean.  Whether the previous upload changed db content.
+                Different from report_success because "previous upload"
+                ignores session expiration.  (Unlike report_success,
+                db_changed is a form variable, not a session variable.)
     session_expired  Boolean.  Whether the session has expired.
     last_key     Token to detect duplicate uploads.
     db
index 12d77ab0cea3a09d1fb31b086494759fa8b42a1e..ba315dc436a78bdcc48b78ef40ef8e4d6f0bcbd3 100644 (file)
            name="csrf_token"
            value="${csrf_token}"
            />
+    % if db_changed is not None:
+    <%doc>This is a hack.  It should be fixed so that only double-upload
+    detecting forms unconditionally generate this element.</%doc>
+    <input type="hidden"
+           name="db_changed"
+           value="${db_changed}"
+           />
+    % endif
 </%def>
 
 <%def name="user_row(tabindex, havecreds, user)">