Commit Graph
486 Commits
Author SHA1 Message Date
Rodrigo Cortés Cano 755f6c3990 Reconcile 3.3 MySQL upgrades on master (#1089)
fix regression in MySQL database update order. See #971

thanks @TrapoSAMA and @csware
2026-07-23 09:31:31 +01:00
Kent Riboe 0f68dee15c viewlog: per-page selector + Bootstrap 5 pager, fix footer layout (#1062) (#1063)
Improve pagination on viewlog page (make page size configurable, use bootstrap 5 pager) 

Closes #1062. Thanks @knofte
2026-07-05 20:21:19 +01:00
Kent Riboe d6aabd7745 viewlog: add "All domains" option to the log viewer (#1059) (#1060)
Adds an **"All domains"** option to the View Log domain dropdown, so an
admin managing many domains can see log entries across all of them in
one view instead of picking each domain individually.

Closes #1059.

Thanks @knofte
2026-07-01 16:22:21 +01:00
Copilot ae7339afd4 Use native booleans for prepared SQL params; stop binding db_get_boolean() values (#1019)
Prepared statements were binding DB-specific boolean literals (`'t'/'f'`) produced by `db_get_boolean()`, which breaks PostgreSQL parameter typing in some paths (notably mailbox creation via handler flows). 

This change standardizes bound boolean parameters to native PHP `true`/`false` (which are then cast to 0/1 which seems to work fine within PDO/PostgreSQL).

fixes https://github.com/postfixadmin/postfixadmin/issues/1017
2026-04-23 19:28:01 +01:00
Kent Riboe 2cce49a657 Add tests for db_where_clause() and db_delete() with additional params (#1021)
Adds test coverage for the core query-building functions refactored in #1004:
 - db_where_clause()
 - db_delete()
2026-04-22 13:41:47 +01:00
Kent Riboe 26530c5d0b Replace escape_string() concatenation with parameterized queries (#1004)
* Replace most escape_string() usages with parameterized queries (reducing the chance of SQL injection), see also #1003 

thanks @knofte
2026-04-06 20:47:34 +01: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 b4b0f86df0 fix namespace issue (model\Languages etc) 2026-02-28 19:07:00 +00:00
David Goodwin 0ecc961eb3 make psalm happy 2026-01-29 13:46:21 +00:00
David Goodwin 8d67fb4bdd formatting 2026-01-29 13:42:34 +00:00
David Goodwin db1f495f9b main.php: use db_in_clause() instead (thanks @copilot) 2026-01-29 13:41:04 +00:00
David Goodwin a82177c7c0 simplify salt creation (rely on random_bytes() rather than other means) (thanks @copilot) 2026-01-29 13:38:15 +00:00
David Goodwin 8ef6bfe603 php 8.2 does not support array const things 2026-01-28 09:50:26 +00:00
David Goodwin ff0a3d7636 psalm stuff, add Languages class, token refactor 2026-01-28 09:50:26 +00:00
David Goodwin 52794bede7 misc fixes for psalm after allowing it to be updated 2026-01-28 09:50:26 +00:00
David Goodwin 0c24b067e8 minor code refactoring (login / TotpPf) 2026-01-28 09:50:26 +00:00
David Goodwin 90d407b5fe token renames (a variable called SESSID_USERNAME makes me think it is reserved by PHP or something, which I do not think it actually is, so just user a more meaningful $username 2026-01-28 09:50:26 +00:00
Sven Strickroth da5dc01de3 No need to specify charset in connection string and then set it explicitly using "SET NAMES" again
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2026-01-25 11:20:57 +01:00
David Goodwin 7f1d78e2cd fix issues from merging #958 - no longer provide smtp_password to smtp_mail(..) call, as it does it internally now 2026-01-01 13:40:17 +00:00
David Goodwin 5196a823ba formatting 2026-01-01 13:33:05 +00:00
arymaynart 5d48dd375c Refactor smtp_mail function for improved clarity
Need to do a tweak to work with broadcast messages
2025-12-19 18:26:03 -03:00
arymaynart 42a664e9c2 Refactor smtp_mail for better SMTP support
Refactor smtp_mail function to improve SMTP handling and error logging.
2025-12-19 17:19:48 -03:00
Christian Boltz 4b20d2be2b Fix hardcoded table name mailbox_app_password
... which exploded when using custom table names.
2025-09-11 22:39:57 +02:00
David Goodwin 460c624275 remove more references to sourceforge 2025-07-13 18:29:37 +01:00
David Goodwin 0d5edbf099 move pacol() into PFAHandler class, I think it makes more sense for it to be there given the dependency between the two 2025-07-13 10:12:22 +01:00
David Goodwin 066d6d10a8 bump db min version 2025-07-12 19:28:39 +01:00
David Goodwin ab0f7897fd drop support for legacy 2a bcrypt variants as we do not support PHP before <= 5.3.7 any longer 2025-06-01 15:43:15 +01:00
David Goodwin b56d0082ff token refactoring 2025-06-01 15:42:50 +01:00
David Goodwin ace5624508 change generate_password() to allow for repeated characaters, which probably provides more entropy. 2025-06-01 15:42:09 +01:00
David Goodwin 06a2cda24b this should be a better PFA_Cookie random token value 2025-06-01 15:41:30 +01:00
David Goodwin 293e318200 remove unused/dead code 2025-06-01 15:39:56 +01:00
David Goodwin 65db542ad2 php type hint and phpdoc changes 2025-06-01 15:39:03 +01:00
David Goodwin 999bfcfc54 drop support for mysql_encrypt, given MySQL after 5.7 has dropped it and we had not wired it into the pacrypt() function anyway, try and improve docs in config.inc.php 2025-05-28 09:41:22 +01:00
David Goodwin 798e8b269c Topt app passwords fixes (WIP) (#805)
various improvements to the TOTP code see also:  #802
2025-05-16 20:31:20 +01:00
David Goodwin 759304ecb8 apparently these all need reformatting 2024-12-05 14:33:41 +00:00
David Goodwin c32f344b9d formatting? 2024-05-31 19:27:12 +01:00
David Goodwin 519c934ed3 Add minimal cron job to remove old vacation alias records - see https://github.com/postfixadmin/postfixadmin/issues/832 2024-05-31 19:25:53 +01:00
David Goodwin 56dd787ce2 when going through password recovery, only wipe the recovery token after the user has updated their password
see https://github.com/postfixadmin/postfixadmin/issues/550
2024-05-17 22:02:01 +01:00
David Goodwin f01274ec94 try relaxing composer dependencies to allow php8.2 dev support, reformat so composer format passes 2024-04-22 21:02:01 +01:00
Shao Yu-Lung (Allen) 0876c368e4 feat: support Dovecot DIGEST-MD5 (#816)
Add support for dovecot DIGEST-MD5 auth (using : $CONF['pacrypt'] = 'dovecot:DIGEST-MD5') 

This also changes the pacrypt() function to take an optional 3rd argument (username). 
Thanks @bestlong
2024-04-12 09:57:19 +01:00
David Goodwin 45557a6ed4 code formatting fix 2024-01-11 08:57:27 +00:00
David Goodwin eda637df1a Merge branch 'master' into michaelkrieger-patch-1 2024-01-11 08:51:17 +00:00
David Goodwin 39e378c783 improve type hinting 2023-12-27 16:17:55 +00:00
David Goodwin 015d4ec9cd reindent / reformat; add type hints for some of the app password stuff; try and make sure someone can only remove their own app password (see revokeAppPassword() ) 2023-12-23 21:43:31 +00:00
David Goodwin 4d17aa6ef9 manaul merge in of verdigado:master (see #753) (MFA/TOTP support) 2023-12-23 17:05:52 +00:00
David Goodwin 2d540e1da7 give the language selector an id - see #736 - thanks @frzquerty 2023-06-23 21:11:09 +01:00
David Goodwin d99d1785b4 fix pacrypt() call - if we have passwords stored like $1$... they are PHP_CRYPT:MD5, and treating them as crypt does not work with dovecot 2023-03-09 21:59:35 +00:00
Thomas GALLIOU e53b5e8a58 Update functions.inc.php
$conf['encrypt'] = 'dovecot:CRAM-MD5'

never success !

function _pacrypt_dovecot() will be never used

See my propose to run with dovecot:CRYPT-METHOD
2023-02-20 19:44:13 +01:00
David Goodwin 65aea00a1f see https://github.com/postfixadmin/postfixadmin/issues/667 - re-use smtp_get_admin_email(), try and make sure there is a From: set in password recovery emails 2022-11-30 21:18:06 +00:00
David Goodwin 3017ea3f3c psalm fixes (drop safeserver() (not used), $_COOKIE always contains strings etc). 2022-10-12 20:52:49 +01:00