
import requests

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





def 		SCREAMING_SNAKE_CASE__      ( __lowerCAmelCase							):
    # Enter your recaptcha secret key here
    snake_case__  =			"secretKey"
    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(__lowerCAmelCase      ,						"login.html"							)

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

    # post recaptcha response to Google's recaptcha api
    snake_case__  =			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
        snake_case__  =			authenticate(__lowerCAmelCase      ,						username=__lowerCAmelCase      ,						password=__lowerCAmelCase							)
        if user_in_database:
            login(__lowerCAmelCase      ,						__lowerCAmelCase							)
            return redirect("/your-webpage"							)
    return render(__lowerCAmelCase      ,						"login.html"							)





def 		SCREAMING_SNAKE_CASE__      ( __lowerCAmelCase							):
    if len(__lowerCAmelCase							) > 1:
        snake_case__  =			len(__lowerCAmelCase							) // 2  # Finds the middle of the array
        snake_case__  =			arr[
            :middle_length
        ]  # Creates an array of the elements in the first half.
        snake_case__  =			arr[
            middle_length:
        ]  # Creates an array of the elements in the second half.
        snake_case__  =			len(__lowerCAmelCase							)
        snake_case__  =			len(__lowerCAmelCase							)
        merge(__lowerCAmelCase							)  # Starts sorting the left.
        merge(__lowerCAmelCase							)  # Starts sorting the right
        snake_case__  =			0  # Left Counter
        snake_case__  =			0  # Right Counter
        snake_case__  =			0  # Position Counter
        while (
            left_index < left_size and right_index < right_size
        ):  # Runs until the lowers size of the left and right are sorted.
            if left_array[left_index] < right_array[right_index]:
                snake_case__  =			left_array[left_index]
                left_index += 1
            else:
                snake_case__  =			right_array[right_index]
                right_index += 1
            index += 1
        while (
            left_index < left_size
        ):  # Adds the left over elements in the left half of the array
            snake_case__  =			left_array[left_index]
            left_index += 1
            index += 1
        while (
            right_index < right_size
        ):  # Adds the left over elements in the right half of the array
            snake_case__  =			right_array[right_index]
            right_index += 1
            index += 1
    return arr


if __name__ == "__main__":
     import doctest

     doctest.testmod()



