<commit_before>from django import forms
from django.shortcuts import render
from django.shortcuts import redirect
from django.contrib.auth.forms import UserCreationForm as OriginUserCreateForm
from django.contrib.auth import login


class UserCreationForm(OriginUserCreateForm):
    email = forms.EmailField()


def index(request):
    if request.user.is_authenticated():
        return redirect('app')
    else:
        return render(request, 'index.html')


def app(request):
    return render(request, 'app.html')


def signup(request):
    if request.user.is_authenticated():
        return redirect('app')

    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            new_user = form.save()
            login(request, new_user)
            return redirect('app')
    else:
        form = UserCreationForm()

    return render(request, 'registration/signup.html', {
        'form': form,
    })
<commit_msg>make app view to be login required<commit_after>from django import forms
from django.shortcuts import render
from django.shortcuts import redirect
from django.contrib.auth import login
from django.contrib.auth.forms import UserCreationForm as OriginUserCreateForm
from django.contrib.auth.decorators import login_required


class UserCreationForm(OriginUserCreateForm):
    email = forms.EmailField()


def index(request):
    if request.user.is_authenticated():
        return redirect('app')
    else:
        return render(request, 'index.html')


@login_required
def app(request):
    return render(request, 'app.html')


def signup(request):
    if request.user.is_authenticated():
        return redirect('app')

    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            new_user = form.save()
            login(request, new_user)
            return redirect('app')
    else:
        form = UserCreationForm()

    return render(request, 'registration/signup.html', {
        'form': form,
    })

{'fraction_non_alphanumeric': 0.10034431874077718, 'fraction_numerical': 0.0, 'mean_word_length': 3.228690228690229, 'pattern_counts': {'":': 0, '<': 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': '3579222', 'n_tokens_mistral': 570, 'n_tokens_neox': 547, 'n_words': 147}