Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reCAPTCHA Preventing Login on Localhost #12

Open
K02D opened this issue Apr 21, 2024 · 1 comment
Open

reCAPTCHA Preventing Login on Localhost #12

K02D opened this issue Apr 21, 2024 · 1 comment

Comments

@K02D
Copy link

K02D commented Apr 21, 2024

This is what I get when I run the project locally:
image

My ALLOWED_HOSTS is [] in settings.py. How do I fix the reCAPTCHA error? I think you might have to add localhost to your list of supported domains in your reCAPTCHA console (reference). Thank you!

@Ansarimajid
Copy link
Owner

First you need to visit ReCaptcha Login and then go to admin console there are Add Option you need to fill all the details then you get public and private key!!

Once you get the public and private key replace with existing keys in code :

  • public key : login.html
    class="g-recaptcha" data-sitekey="6LfHPwojAAAAAAmIefBYBh_y9qTAmKrzIXWF_6FZ"

  • private key : views.py
    captcha_token = request.POST.get('g-recaptcha-response')
    captcha_url = "https://www.google.com/recaptcha/api/siteverify"
    captcha_key = "6LfHPwojAAAAAAtIjbi-7_N4fNf7Wp0LUiYlCDw_" # Consider using your secret key
    data = {
    'secret': captcha_key,
    'response': captcha_token
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants