






import requests

try:
      from django.contrib.auth import authenticate, login
      from django.shortcuts import redirect, render
except ImportError:
      __UpperCAmelCase      				=							__UpperCAmelCase      				=							__UpperCAmelCase      				=							__UpperCAmelCase      				=							print





def 		A_			(		lowercase_	)							->Optional[Any]:







 """simple docstring"""

 SCREAMING_SNAKE_CASE							  =						'secretKey'
 SCREAMING_SNAKE_CASE							  =						'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
 SCREAMING_SNAKE_CASE							  =						request.POST.get('username'	)
 SCREAMING_SNAKE_CASE							  =						request.POST.get('password'	)
 SCREAMING_SNAKE_CASE							  =						request.POST.get('g-recaptcha-response'	)

 # post recaptcha response to Google's recaptcha api
 SCREAMING_SNAKE_CASE							  =						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
  SCREAMING_SNAKE_CASE							  =						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


__UpperCAmelCase      				=							{"configuration_visual_bert": ["VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "VisualBertConfig"]}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __UpperCAmelCase      				=							[
          "VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST",
          "VisualBertForMultipleChoice",
          "VisualBertForPreTraining",
          "VisualBertForQuestionAnswering",
          "VisualBertForRegionToPhraseAlignment",
          "VisualBertForVisualReasoning",
          "VisualBertLayer",
          "VisualBertModel",
          "VisualBertPreTrainedModel",
      ]


if TYPE_CHECKING:
      from .configuration_visual_bert import VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, VisualBertConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_visual_bert import (
                VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
                VisualBertForMultipleChoice,
                VisualBertForPreTraining,
                VisualBertForQuestionAnswering,
                VisualBertForRegionToPhraseAlignment,
                VisualBertForVisualReasoning,
                VisualBertLayer,
                VisualBertModel,
                VisualBertPreTrainedModel,
            )


else:
      import sys

      __UpperCAmelCase      				=							_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)




