From f67f5297f20f1cf876d9fdf702cdd1028ccf8fc2 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Thu, 13 May 2021 22:44:16 +0200 Subject: [PATCH] Add HIBP checks --- app/config.py | 3 + app/dashboard/templates/dashboard/index.html | 7 ++ app/models.py | 28 ++++++++ cron.py | 65 +++++++++++++++++++ example.env | 6 +- .../versions/2021_051419_04b16f5e207e_.py | 48 ++++++++++++++ poetry.lock | 61 +++++++++++++++-- pyproject.toml | 1 + server.py | 5 ++ 9 files changed, 217 insertions(+), 7 deletions(-) create mode 100644 migrations/versions/2021_051419_04b16f5e207e_.py diff --git a/app/config.py b/app/config.py index 4dc11beb..be424cf2 100644 --- a/app/config.py +++ b/app/config.py @@ -374,3 +374,6 @@ except Exception: ALIAS_LIMIT = os.environ.get("ALIAS_LIMIT") or "100/day;50/hour;5/minute" ENABLE_SPAM_ASSASSIN = "ENABLE_SPAM_ASSASSIN" in os.environ + +HIBP_SCAN_INTERVAL_DAYS = os.environ.get("HIBP_SCAN_INTERVAL_DAYS") or 7 +HIBP_API_KEYS = sl_getenv("HIBP_API_KEYS", list) or [] \ No newline at end of file diff --git a/app/dashboard/templates/dashboard/index.html b/app/dashboard/templates/dashboard/index.html index e3a8d1a4..dd3cf41e 100644 --- a/app/dashboard/templates/dashboard/index.html +++ b/app/dashboard/templates/dashboard/index.html @@ -202,6 +202,13 @@ {% endif %} + + {% if alias.hibp_breaches | length > 0 %} + + + + {% endif %}