import requests

try:
     from django.contrib.auth import authenticate, login
     from django.shortcuts import redirect, render
except ImportError:
     _SCREAMING_SNAKE_CASE   						=    _SCREAMING_SNAKE_CASE   						=    _SCREAMING_SNAKE_CASE   						=    _SCREAMING_SNAKE_CASE   						=    print
def 				__lowercase	(						lowerCamelCase__					)				->int:

  '''simple docstring'''




  a__     		=     "secretKey"
  a__     		=     "https://www.google.com/recaptcha/api/siteverify"

  # when method is not POST, direct user to login page
  if request.method != "POST":
    return render(lowerCamelCase__ ,				"login.html"					)

  # from the frontend, get username, password, and client_key
  a__     		=     request.POST.get("username"					)
  a__     		=     request.POST.get("password"					)
  a__     		=     request.POST.get("g-recaptcha-response"					)

  # post recaptcha response to Google's recaptcha api
  a__     		=     requests.post(lowerCamelCase__ ,				data={"secret": secret_key, "response": client_key}					)
  # if the recaptcha api verified our keys
  if response.json().get("success" ,				lowerCamelCase__					):
    # authenticate the user
    a__     		=     authenticate(lowerCamelCase__ ,				username=lowerCamelCase__ ,				password=lowerCamelCase__					)
    if user_in_database:
      login(lowerCamelCase__ ,				lowerCamelCase__					)
      return redirect("/your-webpage"					)
  return render(lowerCamelCase__ ,				"login.html"					)


_SCREAMING_SNAKE_CASE   						=    [0.485, 0.456, 0.406]
_SCREAMING_SNAKE_CASE   						=    [0.229, 0.224, 0.225]
_SCREAMING_SNAKE_CASE   						=    [0.5, 0.5, 0.5]
_SCREAMING_SNAKE_CASE   						=    [0.5, 0.5, 0.5]
_SCREAMING_SNAKE_CASE   						=    [0.48145466, 0.4578275, 0.40821073]
_SCREAMING_SNAKE_CASE   						=    [0.26862954, 0.26130258, 0.27577711]

