From 94605530867bbe522fa0300cc47661612676b632 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 17 Feb 2023 09:40:31 +0000 Subject: [PATCH] Read TOTP variables from .env --- .env.example | 6 ++++++ bookwyrm/settings.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 4c1c2eefe..b47c683c5 100644 --- a/.env.example +++ b/.env.example @@ -120,3 +120,9 @@ OTEL_SERVICE_NAME= # for your instance: # https://docs.djangoproject.com/en/3.2/ref/settings/#secure-proxy-ssl-header HTTP_X_FORWARDED_PROTO=false + +# TOTP settings +# TWO_FACTOR_LOGIN_VALIDITY_WINDOW sets the number of codes either side +# which will be accepted. +TWO_FACTOR_LOGIN_VALIDITY_WINDOW=2 +TWO_FACTOR_LOGIN_MAX_SECONDS=60 diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index d8c554742..fc83fba9b 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -368,8 +368,8 @@ OTEL_EXPORTER_OTLP_ENDPOINT = env("OTEL_EXPORTER_OTLP_ENDPOINT", None) OTEL_EXPORTER_OTLP_HEADERS = env("OTEL_EXPORTER_OTLP_HEADERS", None) OTEL_SERVICE_NAME = env("OTEL_SERVICE_NAME", None) -TWO_FACTOR_LOGIN_MAX_SECONDS = 60 -TWO_FACTOR_LOGIN_VALIDITY_WINDOW = 2 +TWO_FACTOR_LOGIN_MAX_SECONDS = env.int("TWO_FACTOR_LOGIN_MAX_SECONDS") +TWO_FACTOR_LOGIN_VALIDITY_WINDOW = env.int("TWO_FACTOR_LOGIN_VALIDITY_WINDOW") HTTP_X_FORWARDED_PROTO = env.bool("SECURE_PROXY_SSL_HEADER", False) if HTTP_X_FORWARDED_PROTO: