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 · 4 comments
Open

reCAPTCHA Preventing Login on Localhost #12

K02D opened this issue Apr 21, 2024 · 4 comments

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
    }

@SAMTECH0208
Copy link

if we disable the Recaptcha and give your given email id and password shows invalid details .what can I do?

@Ansarimajid
Copy link
Owner

if we disable the Recaptcha and give your given email id and password shows invalid details .what can I do?

If disabling the reCAPTCHA and providing the given email ID and password shows "invalid details," you can create another superuser to access the admin panel. If you are already able to run the application locally, you just need to run one command to create a new superuser:

python manage.py createsuperuser

@SAMTECH0208
Copy link

SAMTECH0208 commented Jul 24, 2024 via email

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

3 participants