

'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


_snake_case     						=						{
    'configuration_rwkv': ['RWKV_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RwkvConfig', 'RwkvOnnxConfig'],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _snake_case     						=						[
        'RWKV_PRETRAINED_MODEL_ARCHIVE_LIST',
        'RwkvForCausalLM',
        'RwkvModel',
        'RwkvPreTrainedModel',
    ]


if TYPE_CHECKING:
    from .configuration_rwkv import RWKV_PRETRAINED_CONFIG_ARCHIVE_MAP, RwkvConfig, RwkvOnnxConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_rwkv import (
            RWKV_PRETRAINED_MODEL_ARCHIVE_LIST,
            RwkvForCausalLM,
            RwkvModel,
            RwkvPreTrainedModel,
        )
else:
    import sys

    _snake_case     						=						_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)








'''simple docstring'''
import requests

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







def       _A	(			snake_case  )    ->			Any:
   # Enter your recaptcha secret key here
   _lowercase    :   Optional[Any]      =     "secretKey"
   _lowercase    :   Union[str, Any]      =     "https://www.google.com/recaptcha/api/siteverify"

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

   # from the frontend, get username, password, and client_key
   _lowercase    :   Optional[int]      =     request.POST.get("username"  )
   _lowercase    :   Tuple      =     request.POST.get("password"  )
   _lowercase    :   Tuple      =     request.POST.get("g-recaptcha-response"  )

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






