




import requests

try:
      from django.contrib.auth import authenticate, login
      from django.shortcuts import redirect, render
except ImportError:
      __SCREAMING_SNAKE_CASE      :				List[Any]				      =print

def      lowerCAmelCase_     (					lowerCamelCase:    int  )   ->     Optional[Any]:


 '''simple docstring'''




 lowerCamelCase__ 					=			'secretKey'
 lowerCamelCase__ 					=			'https://www.google.com/recaptcha/api/siteverify'

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

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

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





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__SCREAMING_SNAKE_CASE      :				int				      ={"""configuration_nat""": ["""NAT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NatConfig"""]}


try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __SCREAMING_SNAKE_CASE      :				Optional[int]				      =[
          """NAT_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """NatForImageClassification""",
          """NatModel""",
          """NatPreTrainedModel""",
          """NatBackbone""",
      ]

if TYPE_CHECKING:
      from .configuration_nat import NAT_PRETRAINED_CONFIG_ARCHIVE_MAP, NatConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_nat import (
                NAT_PRETRAINED_MODEL_ARCHIVE_LIST,
                NatBackbone,
                NatForImageClassification,
                NatModel,
                NatPreTrainedModel,
            )

else:
      import sys

      __SCREAMING_SNAKE_CASE      :				Any				      =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)