tbar0970 / jethro-pmm

Jethro Pastoral Ministry Manager
GNU General Public License v3.0
35 stars 25 forks source link

Error in logs: 'Cannot add note, no person ID specified' when form is submitted after timeout #1041

Open jefft opened 3 months ago

jefft commented 3 months ago

We're seeing occasional errors from Jethro:

Cannot add note, no person ID specified
Line 16 of /home/jethro/public_html/demo/views/view_0_add_note_to_person.class.php

To replicate:

  1. Log in
  2. Persons -> List All
  3. Tick a person, and from the drop-down, choose 'Add Note'
  4. In a second tab, log out of Jethro (to simulate a timeout)
  5. In the first tab, finish filling in the form and submit. You will be redirect to the login page
  6. Log in again. Jethro redirects to /?view=_add_note_to_person, but this time has an error at the top:

image

There's probably other situations like this where timeout interrupts a stateful operation, and the state is forgotten but the redirect tries to resume the operation.

tbar0970 commented 3 months ago

Maybe the login form could somehow detect this kind of scenario, where the post data is lost and the destination view won't cope without it, and redirect to the home page with a message.

The alternative would be for the login form to capture and re-submit the post data (extra hidden fields in the login form). But that would be iffy if the next login is potentially much later, and the action might no longer be relevant. I guess it could have a time limit.