Commit Graph

720 Commits

Author SHA1 Message Date
Carlos Quintana df78109da4 refactor(email_handler): replace_headers_when_forward 2025-04-16 11:04:20 +02:00
Carlos Quintana 0e95f3d047 feat: allow to limit max email recipients (#2436)
* feat: allow to limit max email recipients

* Set cmake min version

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2025-04-14 16:03:02 +02:00
Carlos Quintana c7cbc7a4c8 chore: update error message alias custom domain (#2432) 2025-04-04 12:36:59 +02:00
Carlos Quintana 7a707bdb6d fix: trash custom domain alias deletes it (#2429)
* fix: trash custom domain alias deletes it

* chore: remove redundant commits
2025-03-27 16:33:49 +01:00
Carlos Quintana 9e8ee6467c fix: only allow api_to_cookie if is for same user (#2423) 2025-03-20 15:45:24 +01:00
Adrià Casajús 3962ab5fb0 Preserve Unsubscribe header and create one that always unsubs via alias (#2419)
* Preserve original unsubs

* Preserve original behaviour in an extra header
2025-03-19 10:59:18 +01:00
Carlos Quintana 84364a1684 feat: alias restore check quota (#2418)
* feat: alias restore check quota

* Update app/dashboard/views/alias_trash.py

Co-authored-by: Adrià Casajús <acasajus@users.noreply.github.com>

* Update app/dashboard/views/alias_trash.py

Co-authored-by: Adrià Casajús <acasajus@users.noreply.github.com>

---------

Co-authored-by: Adrià Casajús <acasajus@users.noreply.github.com>
2025-03-18 11:05:09 +00:00
Carlos Quintana a70baad478 Implement Alias Trash (#2417)
* wip: start implementing alias trash

* Added alias trash dashboard page

* test: delete_alias changes

* Format html

* fix: mailbox deletion

* feat: add delete_alias_action setting in dashboard settings

* chore: disable alias when trashing it

* Add restore tests

* Move tras/restore to alias_actions

* rename alias_actions to alias_delete

* Remove alias_actions

* Send events and alias audit log on alias restore

* feat: adapt queries to trashed alias

* chore: add metrics on alias trash actions

* fix: missing empty arg

* Add rate limit for restore and restore all

* fix: mailbox alias count

* feat: properly handle alias deletion for custom domain deletion

* chore: add error logs

* chore: update alias trash copy + change Trash location

* feat: make can_create_new_alias not take trashed aliases into account

* chore: update mailbox deletion dialog copy

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2025-03-18 10:10:56 +01:00
Carlos Quintana 352be83839 deps: update flask-limiter and redis deps (#2406) 2025-03-04 09:48:38 +01:00
Carlos Quintana 78aa169c10 feat: add monitoring to job runner (#2404)
* feat: add monitoring to job runner

* feat: add proper error handling in job runner

* chore: unify newrelic metric
2025-02-27 15:42:20 +00:00
Carlos Quintana b06f6dde76 refactor: move job names to enum in constants (#2401) 2025-02-26 16:52:49 +01:00
Carlos Quintana 59957ec08b chore: fix regex warnings on python 3.12 (#2400)
* deps: update some dependencies to fix warnings

* chore: move from sl.local to sl.lan for local development

* fix: mark string as regex

* chore: move facebook import to handler so its not global

* test: fix tests

* style: lint fixes

* test: move all .test and .local to .lan

* ci: do not use setup-python in lint
2025-02-26 15:41:50 +01:00
Carlos Quintana abdbbe98a2 feat: job runner priorities (#2394)
* feat: job runner priorities

* chore: remove duplicate index
2025-02-25 16:28:01 +01:00
Adrià Casajús 9c3f346280 Allow several job runners to run in parallel (#2281)
* Allow several job runners to run in parallel

* Fix test

* fix: job_runner

---------

Co-authored-by: Carlos Quintana <carlos.quintana@proton.ch>
2025-02-25 15:02:51 +01:00
Adrià Casajús 7e77afa4fc Fix: if there's an expired manual sub, extend it (#2393) 2025-02-21 14:44:31 +01:00
Adrià Casajús 869ea8bd7d Set mailbox verified on pre-verified email change 2025-02-11 10:53:21 +01:00
Adrià Casajús da93431df8 Clear new_email on verified email change (#2383) 2025-02-06 10:27:35 +01:00
Adrià Casajús e17ae4210b Proper check of mx domains (#2382)
* Proper check of mx domains

* Moved proton servers to config

* Added function

* Make sure we have a global dns

* Typo
2025-02-05 14:28:08 +01:00
Adrià Casajús 8d8ca3312a Send event on account unlink (#2379)
* Send event on account unlink

* Move unlink to its own module
2025-02-05 09:44:42 +00:00
Adrià Casajús b0a94acaba Handle the case for duplicate new_email (#2378) 2025-02-04 15:35:14 +00:00
Adrià Casajús 91e614ab50 Do not allow lifetime coupons for lifetime partneri (#2376) 2025-02-03 11:20:12 +01:00
Adrià Casajús a609b3b312 Multi domain check (#2372)
* Accept partner and sl domains

* fix

* Fix html

* properly calculate mx_domains

* Improve custom domain admin template

* reformat
2025-01-31 16:36:35 +00:00
Carlos Quintana ff79fa020f feat: index cleanup and add missing ones (#2369)
* feat: index cleanup and add missing ones

* chore: remove case in favour of greatest in query

* fix: do not remove mailbox->user index

* Fix test due to random ordering

* Create rollback

* Bad syntax

* fix order also

* test: fix ordering

* fix: ordering on mailboxes

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2025-01-31 10:50:33 +01:00
Adrià Casajús c14d7e2098 Handle multiple emails in reply-to header (#2365) 2025-01-24 10:20:50 +00:00
Adrià Casajús f4b56788d7 Extract mailbox email change into an util (#2366)
* Extract mailbox email change into an util

* Update validation mailbox

* Add tests

* extract mailbox cancel

* Use simple field
2025-01-24 10:16:04 +00:00
Adrià Casajús f232a2af89 Refactor coupon management and send proper events (#2363)
* Refactor coupon management and send proper events

* Refactor coupon management and send proper events

* Add missing case

* Updated with comments

* Use model table names

* renamed tablename to table

* Use sqlalchemy
2025-01-23 12:36:13 +01:00
Adrià Casajús 864b5d13ff Two fixes (#2357)
* Preserve the flags when creating the user from the partner and do not deliver if user is pending deletion

* Fix test
2025-01-15 15:50:28 +00:00
Adrià Casajús 2387d30caa Sanitize the mailbox email before creating it 2024-11-28 17:29:44 +01:00
Adrià Casajús 24987649a9 Add test 2024-11-28 12:32:42 +01:00
Adrià Casajús 0f8408b99c Add support for more Received header formats to extract the queue id (#2333) 2024-11-28 11:11:53 +00:00
Adrià Casajús 14137326e9 Allow to use header from if domain is aligned with envelope (#2332)
* Use the mail_from when receiving a mail to the reverse alias if the domain is aligned with the VERP email

* Extracted function to a different file
2024-11-27 15:43:45 +00:00
Adrià Casajús 665c01d710 Add lifetime in partner subscriptions (#2331)
* Add lifetime in partner subscriptions

* Add lifetime display

* Fixed change
2024-11-27 11:05:03 +00:00
Adrià Casajús dd2cfaea8b Try to catch the race condidion when creating the user with a partner (#2320) 2024-11-14 09:54:13 +01:00
Adrià Casajús 813de9d40b Fix: If the alias is created for a partner domain, mark it as partner created (#2312) 2024-11-08 12:04:28 +01:00
Carlos Quintana a8ca2d3d37 revert: userid storing on deleted alias (#2305) 2024-11-06 11:24:54 +00:00
Carlos Quintana 31c8a766be feat: preserve user id on alias deleted (#2304) 2024-11-06 09:16:54 +00:00
Adrià Casajús 7295a2052f Mark if a verification code has been deleted (#2290) 2024-10-25 08:29:33 +00:00
Carlos Quintana d65994c3c6 fix: missing None check on alias contacts api (#2288) 2024-10-24 07:50:35 +00:00
Adrià Casajús ccd687f091 Add job to send events to webhook (#2282)
* Add job to send events to webhook

* Apply comments

---------

Co-authored-by: Carlos Quintana <74399022+cquintana92@users.noreply.github.com>
2024-10-23 17:01:32 +02:00
Adrià Casajús 9646f84b79 Only send new alias events on user creation (#2285)
* Only send new alias events on user creation

(cherry picked from commit ab8f998dd40dc83c8f8a528a156ba50eae376aaf)

* Trigger a sync when a new partner user is created

* Improve tests

* Move it to the partner_utils

---------

Co-authored-by: Carlos Quintana <74399022+cquintana92@users.noreply.github.com>
2024-10-23 11:18:03 +02:00
Carlos Quintana f55ab58d0c fix: prevent mailbox disclosure (#2284) 2024-10-23 10:24:15 +02:00
Carlos Quintana 1afd392e5c fix: crash on empty mailbox email (#2283) 2024-10-22 10:06:20 +02:00
Carlos Quintana 67b3820f61 feat: audit log and admin panel improvements (#2274)
* feat: add deleted alias audit logs

* feat: emit event when user is created or password reset

* feat: improve admin panel
2024-10-18 13:32:26 +00:00
Carlos Quintana 06201a517c fix: mailbox email change verification crash (#2272) 2024-10-18 09:45:18 +02:00
Adrià Casajús 3c13f1ce20 Have the dead letter also take events to avoid race conditions (#2267)
* Have the dead letter also take events to avoid race conditions

* Ensure we take the event

* Tests for event taken

* Rename
2024-10-17 09:16:33 +00:00
Carlos Quintana 2cd6ee777f chore: emit some missing contact audit logs (#2269)
* chore: emit some missing contact audit logs

* chore: improve alias change mailboxes audit message
2024-10-17 09:55:04 +02:00
Carlos Quintana 35f6e67053 feat: user audit log (#2266)
* feat: set up UserAuditLog

* refactor: extract payment callbacks into their own files + handle subscription user_audit_log

* feat: handle account linking for user audit log

* chore: user_audit_log for mailboxes

* chore: user_audit_log for custom domains

* chore: user_audit_log for contacts

* chore: user_audit_log for directories

* fix: do not enforce cronjob being defined in choices + enable user deletion

* chore: user_audit_log for user deletion

* refactor: change emit_user_audit_log function to receive the full user object

* feat: add user_audit_log migration

* test: fix tests

* test: add some tests for user_audit_log

* fix: spf record verification user_audit_log

* chore: add missing index to user_audit_log.created_at

* chore: add missing index to alias_audit_log.created_at
2024-10-16 16:57:59 +02:00
Adrià Casajús b8be0f470a Remove old webhook to send plan changes and rely on events (#2265) 2024-10-15 11:01:26 +02:00
Carlos Quintana 4986ace59f fix: emit mailboxes change event from alias_mailbox_utils (#2264) 2024-10-15 09:39:40 +02:00
Carlos Quintana f3ca74d9b3 chore: unify change alias mailboxes logic (#2262) 2024-10-14 20:25:17 +02:00