diff --git a/INSTALLATION.md b/INSTALLATION.md index cfc757467c4912a48b50003b8eeb20b950d0e30f..d7a1cda29ae06d99e95d4467ce5553bba8028114 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -14,6 +14,7 @@ Boolean type variables use consider `true` and `yes` as truthy, and `false` and - `INJECT_LOGS`: _string, default=backend-logs.log_ - Path to a file where to save logs. - `INJECT_DOMAIN`: _string, default=""_ - Domain where yours instance of the INJECT is available. - `INJECT_SECRET_KEY`: _string_ - Used to provide cryptographic signing. Must be at least 50 long characters string. +- `INJECT_EMAIL_TIMEOUT`: _int, default=10_ - Specifies a timeout in seconds for blocking operations like the connection attempt to SMTP. diff --git a/ttxbackend/settings.py b/ttxbackend/settings.py index 59381aaae83e4cae6522f719feda95c54fa506a1..42960646cb60c52bd34f78cf52acfdbed9e3d5a0 100644 --- a/ttxbackend/settings.py +++ b/ttxbackend/settings.py @@ -241,13 +241,11 @@ EMAIL_BACKEND = ( else "django.core.mail.backends.smtp.EmailBackend" ) EMAIL_HOST = os.environ.get("INJECT_EMAIL_HOST", "") -if email_port := os.environ.get("INJECT_EMAIL_PORT"): - EMAIL_PORT = int(email_port) -else: - EMAIL_PORT = 25 +EMAIL_PORT = int(os.environ.get("INJECT_EMAIL_PORT", 25)) EMAIL_HOST_USER = os.environ.get("INJECT_EMAIL_HOST_USER", "") EMAIL_HOST_PASSWORD = os.environ.get("INJECT_EMAIL_HOST_PASSWORD", "") EMAIL_SENDER_ADDRESS = os.environ.get("INJECT_EMAIL_SENDER_ADDRESS", "") +EMAIL_TIMEOUT = int(os.environ.get("INJECT_EMAIL_TIMEOUT", 10)) DOMAIN = os.environ.get("INJECT_DOMAIN", "") if protocol := os.environ.get("INJECT_EMAIL_PROTOCOL"): diff --git a/user/views.py b/user/views.py index 3a5c1b0769c9806d14807c1b81222b1eb3ff35ed..0e597ecff27cb53925f007d2bfdfce5311f570fa 100644 --- a/user/views.py +++ b/user/views.py @@ -31,5 +31,5 @@ class UploadUserFile(APIView): logger.info(log_user_msg(request, request.user) + "uploaded new users") return UserUploader.validate_and_upload( uploaded_file=uploaded_file, - admin_initiator=request.user.is_superuser, + admin_initiator=request.user.group == User.AuthGroup.ADMIN, )