Commit Graph

188 Commits

Author SHA1 Message Date
Adrià Casajús
2d841e9bc0
Update render function to receive user always as a param (#2141)
* Update render function to receive user always as a param

(cherry picked from commit fb53632298b08ab40bb82b8c8724a0bf254b2632)

* Add user to the kwargs
2024-07-03 12:59:16 +00:00
Son Nguyen Kim
d5df91aab6
Premium user can enable data breach monitoring (#2084)
* add User.enable_data_breach_check column

* user can turn on/off the data breach check

* only run data breach check for user who enables it

* add tips to run tests using a local DB (without docker)

* refactor True check

* trim trailing space

* fix test

* Apply suggestions from code review

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

* format

---------

Co-authored-by: Son NK <son@simplelogin.io>
Co-authored-by: Adrià Casajús <acasajus@users.noreply.github.com>
2024-04-12 10:39:23 +02:00
Adrià Casajús
0da1811311
Cleanup old data (#2066)
* Cleanup tasks

* Update

* Added tests

* Create cron job

* Delete old data cron

* Fix import

* import fix

* Added delete + script to disable pgp for proton mboxes
2024-03-18 16:00:21 +01:00
Adrià Casajús
aa2c676b5e
Only check HIBP alias of paid users (#2065) 2024-03-15 10:13:06 +01:00
Adrià Casajús
30ddd4c807
Update oneshot commands (#2064)
* Update oneshot commands

* fix

* Fix test_load command

* Rename to avoid test executing it

* Do HIBP breach check in batches instead of a single load
2024-03-14 16:03:43 +01:00
Adrià Casajús
e96de79665
Add missing indexes and mark aliases as created by partner (#2058)
* Add missing indexes and mark aliases as created by partner

* Configure if we should skip the partner aliases or not
2024-03-13 14:30:17 +01:00
Adrià Casajús
76423527dd
Update HIBP async script (#2043)
* Update HIBP async script

* Fix: continue instead of return
2024-03-04 13:12:38 +01:00
Adrià Casajús
173ae6a221
Allow to soft-delete users (#2034)
* Allow the possibility of soft-deleting users

* Unschedule for delete after link

* Add dry run to the cron
2024-02-22 17:38:34 +01:00
Adrià Casajús
31896ff262
Replace black and flake8 with ruff (#1943) 2023-11-21 16:42:18 +01:00
Adrià Casajús
e6bcf81726
Delete old email_log entries in batches to avoid table lock (#1902)
* Delete old email_log entries in batches to avoid table lock

* Avoid nested join

* Commiting after the batch delete

* Added statement count print

* Rename var
2023-10-02 10:50:02 +02:00
Adrià Casajús
373c30e53b
Schedule deletion of users (#1872)
* Accounts to be scheduled to be deleted cannot receive emails or login

* Create model and create migration for user

* Add test for the cron function

* Move logic to one place

* Use the class name to call the static delete method
2023-09-10 22:11:50 +02:00
Adrià Casajús
6e4f6fe540
Sanitize alias, contacts, mailboxes and users before creating them (#1829)
* Sanitize alias, contacts, mailboxes and users before creating them

* Updated comments and moved crons to run when load is low

* Run the stats at the same time as previously

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2023-08-03 10:20:25 +02:00
Adrià Casajús
f2dad4c28c
Cron improvements (#1826)
* Yield on big queries and check the trial is active in the query directly

* Eagerly load the hibp aliases to check

* Updated trial condition

* Also yield referral

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2023-07-31 15:14:13 +02:00
Adrià Casajús
e9e863807c
Add missing indexes (#1824)
* Rate limit the sudo route

* Add missing indexes

* Updated index

* Update index creation to run with concurrent

* With autocommit block

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2023-07-29 10:03:31 +02:00
Adrià Casajús
90d60217a4
Feat: Re-deliver mails (#1394)
* Feat: Send undelivered emails

* Add cron job

* Added to the crontab

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2022-11-02 15:51:14 +01:00
Son Nguyen Kim
2f769b38ad
Apple in app fix (#1369)
* error log if issue with apple sub

* use the right secret when polling apple sub
2022-10-25 19:45:53 +02:00
Son Nguyen Kim
cea139b7d5
Improve handling when pgp key is invalid (#1264)
* remove unused email statuses

* add more logging

* use text_header if html_header not set

* improve email

* add a header about PGP failure when forward emails can't be encrypted

* remove unused email status
2022-09-02 11:47:04 +02:00
Son Nguyen Kim
ae2cbf98e2
Handle invalid pgp key (#1260)
* check invalid mailbox pgp key

* check if public key is valid before trying with pgpy

* fix query

* remove unused code
2022-09-01 15:10:11 +02:00
Son Nguyen Kim
72256d935c
do not notify lifetime user about coinbase sub (#1254) 2022-08-30 22:41:08 +02:00
Son Nguyen Kim
b299a305b5
Fix quarantine (#1241)
* add more logging

* fix quarantine email incorrect deleted_at
2022-08-18 14:47:05 +02:00
Adrià Casajús
3a75686898
Generate a web session from an api key (#1224)
* Create a token to exchange for a cookie

* Added Route to exchange token for cookie

* add missing migration



Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2022-08-10 18:48:32 +02:00
Son Nguyen Kim
6aeb710ca0
add nb_proton_user, nb_proton_premium to daily metric email (#1144) 2022-07-05 18:00:28 +02:00
Son Nguyen Kim
66a2152ea3
Compute Proton metrics (#1135)
* compute nb_proton_premium

* compute nb_proton_user
2022-07-04 11:40:29 +02:00
Adrià Casajús
99ce10a1bc
Send email to users with a subscription and a partner plan upgrade (#1101)
* Send email to users with a subscription and a partner plan upgrade

* Update double-subscription-partner.html

* Update double-subscription-partner.txt.jinja2

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
Co-authored-by: Son Nguyen Kim <nguyenkims@users.noreply.github.com>
2022-06-20 14:34:20 +02:00
Son
3d1a960702 fix duplicated stats 2022-02-28 10:43:30 +01:00
Son
c947e7cbd5 improve cron job 2022-02-15 09:36:37 +01:00
Son
cca23b753c Extract daily monitoring report from stats() 2022-02-04 15:45:21 +01:00
Son
94bbade62e refactor 2022-01-10 15:05:15 +01:00
Son
b306abb689 use yield_per_query() in cron whenever possible 2022-01-06 18:52:14 +01:00
Son
01cc9fe388 optimize migrate_domain_trash: bulk create and delete, keep track of progress 2022-01-06 18:30:56 +01:00
Son
17e9798bfd do not use error level in migrate_domain_trash 2022-01-06 15:36:43 +01:00
Son
37bb7655d5 remove unused import 2022-01-06 15:30:33 +01:00
Son
55e3203512 refactor. Remove sleep when checking mailbox domain. 2022-01-06 15:13:59 +01:00
Son
3fb6dd4aeb check if there's an email that starts with "\u200f" (right-to-left mark (RLM)) in cron 2022-01-06 11:07:50 +01:00
Son
414f6a2463 handle case a custom domain is deleted in the meantime 2022-01-03 10:07:41 +01:00
Son
f548e74e77 refactor 2022-01-03 10:06:56 +01:00
Son
b9e2a79933 enable email sending retry in cron job 2021-12-28 16:42:01 +01:00
Son
bd614278df increase bounce info length 2021-12-28 10:51:43 +01:00
Son
922fa4925e handle ObjectDeletedError 2021-12-28 10:21:26 +01:00
Son
32fffeaa6e handle case bounce info too verbose in daily report 2021-12-26 22:25:00 +01:00
Son
4f9bb59b58 don't notify user who already have an non-canceled Paddle subscription 2021-12-01 17:18:19 +01:00
Son
d875b2e0e5 do not send renewal reminder for lifetime user 2021-11-28 12:35:03 +01:00
Son
cd553608a5 fix 2021-11-23 14:35:37 +01:00
Son
f049da8c9a Compare mx domains with priority order and not priority value 2021-11-23 14:31:53 +01:00
Son
04d6ab519b update the custom domain dns issue email template 2021-11-22 10:32:12 +01:00
Son
fdfa286d3e allow contact email to be case sensitive 2021-11-18 16:44:04 +01:00
Son
bccfcee780 add subdomain and directory stats to Metric 2021-11-17 17:43:59 +01:00
Son
38e7a64f4f improve daily report 2021-11-06 12:41:37 +01:00
Son
914696ef3b re-enable bounce report in daily report 2021-11-04 14:28:19 +01:00
Son
d81e9fb75f fix manual subscription reminder sent for lifetime user 2021-11-02 15:47:31 +01:00