7 Commits
Author SHA1 Message Date
vibpe 7a1eb67db2 Send the 419 status with a reason phrase so Apache does not answer 500 (#1209)
Fixes #1208 - add reason phrase with http 419 response (used with  invalid or missing CSRF token is answered with the "Session expired"), otherwise Apache returns a http 500 response instead.

thanks @vibpe
2026-11-20 13:56:53 +00:00
Rodrigo Cortés Cano 42fd9870d4 Improve invalid CSRF token response page (#1067)
Improve CSRF invalid error page

- Replaces the raw hardcoded error with localized PALANG text. 
- Provides a simple Continue link back to main.php

Related to the 4.0 branch fix in PR #1055.
2026-07-03 18:31:55 +01:00
David Goodwin 2ede2c8726 comments 2026-03-11 09:13:38 +00:00
David Goodwin 8a1f9a11af CSRF protection - support multiple tokens (#985)
possible fix for https://github.com/postfixadmin/postfixadmin/issues/967

CSRF Token changes : rather than have one PFA_Token value in $_SESSION, store a list of them, where each value has a time stamp it was issued on. The aim is to allow the user to have multiple browser tabs open at once - and not have the last tab that loaded trample on others. Tokens expire after 1 hour.

Adds a Smarty helper function `{CSRF_Token}` which will output `<input type=hidden name=CSRF_Token value=asdf123>` or `{CSRF_Token type=url}` which outputs a literal string like 'asdf123' suitable for placing in a URL.

Adds a PHP exception handler in public/common.php, which could be used to display a more friendly error message/response (but at the moment is fairly minimal).

Removes most uses of `die()` within the codebase, and instead moves to throw an exception
2026-03-01 19:30:16 +00:00
David Goodwin 2d6ded2786 PSR2 -> PSR12 formatting 2022-06-28 13:46:11 +01:00
Adrien Crivelli 15df6c1d7b Reformat everything with PHP-Cs-Fixer 2018-01-26 23:54:37 +09:00
David Goodwin 99147d51eb move public facing stuff into public/, this allows us to stop exposing templates_c/ etc to the world 2018-01-25 20:27:09 +00:00