From 4add7e626eb48a3e76bb3faf411c85ffe0ba5c7c Mon Sep 17 00:00:00 2001 From: Teddy Middleton-Smith Date: Sat, 15 Mar 2025 18:41:14 +0000 Subject: [PATCH] Fix: ALTCHA secret key missing error. --- controllers/core.py | 4 ++-- forms/contact.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/core.py b/controllers/core.py index 777733f7..6a4bb3af 100644 --- a/controllers/core.py +++ b/controllers/core.py @@ -86,11 +86,11 @@ def contact_post(): @routes_core.route(Model_View_Contact.HASH_ALTCHA_CREATE_CHALLENGE, methods=['GET']) def create_altcha_challenge(): - Helper_App.console_log(f'secret key: {current_app.app_config["ALTCHA_SECRET_KEY"]}') + Helper_App.console_log(f'secret key: {current_app.app_config.ALTCHA_SECRET_KEY}') options = ChallengeOptions( expires = datetime.datetime.now() + datetime.timedelta(hours=1), max_number = 100000, # The maximum random number - hmac_key = current_app.app_config["ALTCHA_SECRET_KEY"], + hmac_key = current_app.app_config.ALTCHA_SECRET_KEY, ) challenge = create_challenge(options) print("Challenge created:", challenge) diff --git a/forms/contact.py b/forms/contact.py index b55cb7d4..38846128 100644 --- a/forms/contact.py +++ b/forms/contact.py @@ -48,7 +48,7 @@ class ALTCHAValidator: decoded_data = base64.b64decode(altcha_data).decode('utf-8') altcha_payload = json.loads(decoded_data) - ok, err = verify_solution(altcha_payload, current_app.app_config["ALTCHA_SECRET_KEY"], check_expires=True) + ok, err = verify_solution(altcha_payload, current_app.app_config.ALTCHA_SECRET_KEY, check_expires=True) if err or not ok: raise ValidationError(self.message + ': ' + (err or 'Invalid solution'))