Bug description
If I'm in an Entry Collection (e.g., Collections > Pages > Home) and I leave the tab open for a long time (maybe I forgot to close it), and then I go back to the same tab without refreshing. I start editing the content associated with that Entry (which could be several large changes), and when I click the Save & Publish button to save the updates, I get a "CSRF token mismatch" alert warning and can't save the changes.
When I refresh the page, I may lose my changes. So my current workaround is to open a new tab, copy the changes, and click "Save & Publish" to save the changes. I don't think I should use this workaround because I have previously logged into the Statamic Control Panel and checked the "Remember Me" box to avoid re-entering my password each time my session expires and to automatically refresh my session.
Also, if I have different tabs open with different Entry Collections, both sessions expire, I refresh one tab but forget to refresh the other tab, and the same scenario described above occurs.
How to reproduce
For a faster reproduce, reduce the SESSION_LIFETIME variable in the .env to 1 or 2
- Log in to the Statamic Control Panel with your credentials, don't forget to check the "Remember me" box.
- Open any Entry Collection (e.g.: Collections > Pages > Home) and leave it open.
- When there is 1 minute left in the session, a red banner should appear informing the user that "You have been inactive for a while and will be logged out in X seconds. Click to extend your session".
- Don't interact with this banner, just wait for the session to expire, and since I checked the "Remember Me" box, I won't have to re-enter my password, and the session will be automatically renewed.
- After the session is automatically renewed, click the "Save & Publish" button and the CSRF Token Mismatch warning will automatically appear.
If I have not clicked the "Remember me" button on the login page, I have to re-enter the password every time the session expires while I am in an entry. Then I can save the entry without any problems and the "CSRF Token Mismatch" warning does not appear.
Logs
No response
Environment
Environment
Application Name: Statamic
Laravel Version: 11.23.2
PHP Version: 8.3.11
Composer Version: 2.7.9
Environment: local
Debug Mode: ENABLED
URL: statamic-test.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file
Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.25.0 Solo
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
Bug description
If I'm in an Entry Collection (e.g., Collections > Pages > Home) and I leave the tab open for a long time (maybe I forgot to close it), and then I go back to the same tab without refreshing. I start editing the content associated with that Entry (which could be several large changes), and when I click the Save & Publish button to save the updates, I get a "CSRF token mismatch" alert warning and can't save the changes.
When I refresh the page, I may lose my changes. So my current workaround is to open a new tab, copy the changes, and click "Save & Publish" to save the changes. I don't think I should use this workaround because I have previously logged into the Statamic Control Panel and checked the "Remember Me" box to avoid re-entering my password each time my session expires and to automatically refresh my session.
Also, if I have different tabs open with different Entry Collections, both sessions expire, I refresh one tab but forget to refresh the other tab, and the same scenario described above occurs.
How to reproduce
For a faster reproduce, reduce the SESSION_LIFETIME variable in the .env to 1 or 2
If I have not clicked the "Remember me" button on the login page, I have to re-enter the password every time the session expires while I am in an entry. Then I can save the entry without any problems and the "CSRF Token Mismatch" warning does not appear.
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response