Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings: Use get_secret for altcha_hmac.

Alex Vandiver74675fae945e
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
index f804305859d..28d5e782f25 100644
--- a/zerver/views/registration.py
+++ b/zerver/views/registration.py
@@ -1269,7 +1269,7 @@ def create_realm(request: HttpRequest, creation_key: str | None = None) -> HttpR
# When settings.OPEN_REALM_CREATION is enabled, anyone can create a new realm,
# with a few restrictions on their email address.
if request.method == "POST":
- if settings.USING_CAPTCHA:
+ if settings.USING_CAPTCHA and settings.ALTCHA_HMAC_KEY:
form: RealmCreationForm = CaptchaRealmCreationForm(data=request.POST, request=request)
else:
form = RealmCreationForm(request.POST)
@@ -1343,7 +1343,7 @@ def create_realm(request: HttpRequest, creation_key: str | None = None) -> HttpR
initial_data = {
"realm_default_language": default_language_code,
}
- if settings.USING_CAPTCHA:
+ if settings.USING_CAPTCHA and settings.ALTCHA_HMAC_KEY:
form = CaptchaRealmCreationForm(request=request, initial=initial_data)
else:
form = RealmCreationForm(initial=initial_data)
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py
index c2bc31f7bc2..ee349f80a7a 100644
--- a/zproject/computed_settings.py
+++ b/zproject/computed_settings.py
@@ -469,7 +469,7 @@ else:
TOR_EXIT_NODE_FILE_PATH = "/var/lib/zulip/tor-exit-nodes.json"
if USING_CAPTCHA:
- ALTCHA_HMAC_KEY = get_mandatory_secret("altcha_hmac")
+ ALTCHA_HMAC_KEY = get_secret("altcha_hmac")
else:
ALTCHA_HMAC_KEY = ""