<commit_before>import os

from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpRequest, HttpResponse
from django.shortcuts import redirect, render
from django.views.defaults import page_not_found, permission_denied
from sentry_sdk import last_event_id

from accounts.models import AccountTier
from manager.api.exceptions import AccountQuotaExceeded


def home(request: HttpRequest) -> HttpResponse:
    """
    Home page view.

    Served at /. Redirects to other urls depending on whether
    the user is authenticated or not.
    """
    # Send OK to Google's health checker which always hits "/"
    # despite settings to the contrary.
    # This is a known bug being tracked here:
    # https://github.com/kubernetes/ingress-gce/issues/42
    # https://github.com/ory/k8s/issues/113#issuecomment-596281449
    user_agent = request.META.get("HTTP_USER_AGENT", "")
    if "GoogleHC" in user_agent:
        return HttpResponse("OK")

    # Redirect to secure version. This needs to be done here to
    # avoid sending a 302 to GoogleHC.
    if settings.SECURE_SSL_REDIRECT and not request.is_secure():
        return redirect("https://" + request.get_host() + "/")

    # Authenticated users get redirected to dashboard
    if request.user.is_authenticated:
        return redirect("ui-accounts-retrieve", request.user.username)

    # Unauthenticated users get redirected to the project listing page
    return redirect("ui-projects-list")


def pricing(request: HttpRequest) -> HttpResponse:
    """
    Pricing page view.

    Served at /pricing/. Normally authenticated users will
    not visit this page, but if they do we pass through their account so that
    they can see which account they are currently on.<commit_msg>fix(Home): Don't redirect authed users to their profile<commit_after>import os

from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpRequest, HttpResponse
from django.shortcuts import redirect, render
from django.views.defaults import page_not_found, permission_denied
from sentry_sdk import last_event_id

from accounts.models import AccountTier
from manager.api.exceptions import AccountQuotaExceeded


def home(request: HttpRequest) -> HttpResponse:
    """
    Home page view.

    Served at /. May redirect to other urls e.g. depending on whether
    the user is authenticated or not.
    """
    # Send OK to Google's health checker which always hits "/"
    # despite settings to the contrary.
    # This is a known bug being tracked here:
    # https://github.com/kubernetes/ingress-gce/issues/42
    # https://github.com/ory/k8s/issues/113#issuecomment-596281449
    user_agent = request.META.get("HTTP_USER_AGENT", "")
    if "GoogleHC" in user_agent:
        return HttpResponse("OK")

    # Redirect to secure version. This needs to be done here to
    # avoid sending a 302 to GoogleHC.
    if settings.SECURE_SSL_REDIRECT and not request.is_secure():
        return redirect("https://" + request.get_host() + "/")

    # Redirect to the project listing page
    return redirect("ui-projects-list")


def pricing(request: HttpRequest) -> HttpResponse:
    """
    Pricing page view.

    Served at /pricing/. Normally authenticated users will
    not visit this page, but if they do we pass through their account so that
    they can see which account they are currently on.
{'fraction_non_alphanumeric': 0.07656675749318802, 'fraction_numerical': 0.011444141689373298, 'mean_word_length': 3.7675324675324675, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 6, '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': '2199610', 'n_tokens_mistral': 1054, 'n_tokens_neox': 994, 'n_words': 364}