<commit_before>from django.shortcuts import redirect
from django.http import request, JsonResponse
from django.conf import settings
from django.contrib.auth.views import logout

from .auth import OXSessionDecryptor


def login(request):
    url = "{}login/".format(settings.ACCOUNTS_SERVER_URL)

    next = request.GET.get("next", None)
    if next:
        url = "{}login/?r={}".format(settings.ACCOUNTS_SERVER_URL, next)

    return redirect(url)


def get_user_data(request):
    cookie = request.COOKIES.get(settings.COOKIE_NAME, None)

    if not cookie:
        return JsonResponse({"logged_in": False, "cookie": False, "validation": False, "decryption": False})

    decrypt = OXSessionDecryptor(secret_key_base=settings.SHARED_SECRET, encrypted_cookie_salt=settings.ENCRYPTED_COOKIE_SALT, encrypted_signed_cookie_salt=settings.SIGNED_ENCRYPTED_COOKIE_SALT)
    validate = decrypt.validate_cookie(cookie)

    if not validate:
        return JsonResponse({"logged_in": False, "cookie": True, "validation": False, "decryption": False})<commit_msg>Renaming Settings<commit_after>from django.shortcuts import redirect
from django.http import request, JsonResponse
from django.conf import settings
from django.contrib.auth.views import logout

from .auth import OXSessionDecryptor


def login(request):
    url = "{}login/".format(settings.ACCOUNTS_SERVER_URL)

    next = request.GET.get("next", None)
    if next:
        url = "{}login/?r={}".format(settings.ACCOUNTS_SERVER_URL, next)

    return redirect(url)


def get_user_data(request):
    cookie = request.COOKIES.get(settings.SECRET_COOKIE_NAME, None)

    if not cookie:
        return JsonResponse({"logged_in": False, "cookie": False, "validation": False, "decryption": False})

    decrypt = OXSessionDecryptor(secret_key_base=settings.SECRET_KEY_BASE, encrypted_cookie_salt=settings.ENCRYPTED_COOKIE_SALT, encrypted_signed_cookie_salt=settings.SIGNED_ENCRYPTED_COOKIE_SALT)
    validate = decrypt.validate_cookie(cookie)

    if not validate:
        return JsonResponse({"logged_in": False, "cookie": True, "validation": False, "decryption": False})
{'fraction_non_alphanumeric': 0.10854176498348278, 'fraction_numerical': 0.0, 'mean_word_length': 5.309523809523809, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2920014', 'n_tokens_mistral': 700, 'n_tokens_neox': 656, 'n_words': 140}