Skip to content

Commit

Permalink
check .env.test:RECAPTCHA_SITE_KEY to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
schiwaa committed Jul 3, 2024
1 parent 1a0db4c commit 1be9a40
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions middleware/stemmaweb_middleware/controller/auth/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,25 @@ def login():
if user_or_none is None:
return abort(status=401, message="Invalid credentials or no such user")

# tmp in experimental branch for debugging
import os
env_all = os.environ
logger.debug(
f"MY_ALL_ENV: `{env_all}`"
)
env_recaptcha_site_key = os.getenv("RECAPTCHA_SITE_KEY")
logger.debug(
f"MY_RSK: `{env_recaptcha_site_key}`"
)

# Verify captcha
if not recaptcha_verifier.verify(body.recaptcha_token):
pass # CAUTION ! tmp to see if it works on github. TO DO: return only when headed.
# return abort(status=429, message="reCAPTCHA verification failed")
# if env_recaptcha_site_key == '6LdZPq4ZAAAAAGx6vHrdtUfUr1HryiDoPu4piwiG':
# pass # .env.dev:RECAPTCHA_SITE_KEY
if env_recaptcha_site_key == '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI':
pass # .env.test:RECAPTCHA_SITE_KEY
else:
return abort(status=429, message="reCAPTCHA verification failed")

# Login user for this flask session
user: StemmawebUser = user_or_none
Expand Down

0 comments on commit 1be9a40

Please sign in to comment.