<commit_before>from django.shortcuts import render, redirect, get_object_or_404
# from django.conf import settings
from django.contrib.auth import authenticate, login, get_user_model
from django.contrib.auth.forms import PasswordChangeForm, SetPasswordForm
from django.contrib.auth.decorators import login_required
from django.contrib import messages

from .forms import RegisterForm, EditAccountForm, PasswordResetForm
from .models import PasswordReset


User = get_user_model()


def register(request):
    template_name = 'accounts/register.html'
    if request.method == 'POST':
        form = RegisterForm(request.POST)
        if form.is_valid():
            user = form.save()
            user = authenticate(
                username=user.username,
                password=<PASSWORD>.cleaned_data['<PASSWORD>']
            )
            login(request, user)
            return redirect('core:home')
    else:
        form = RegisterForm()
    context = {
        'form': form
    }
    return render(request, template_name, context)


@login_required
def dashboard(request):
    template_name = 'accounts/dashboard.html'
    return render(request, template_name)


def password_reset(request):
    template_name = 'accounts/password_reset.html'
    context = {}
    form = PasswordResetForm(request.POST or None)
    if form.is_valid():
        form.save()
        context['success'] = True<commit_msg>Adapt register view to create professor user<commit_after>from django.shortcuts import render, redirect, get_object_or_404
# from django.conf import settings
from django.contrib.auth import authenticate, login, get_user_model
from django.contrib.auth.forms import PasswordChangeForm, SetPasswordForm
from django.contrib.auth.decorators import login_required
from django.contrib import messages

from .forms import (
    RegisterForm,
    EditAccountForm,
    PasswordResetForm,
    RegisterProfessorForm
)
from .models import PasswordReset


User = get_user_model()


def register(request):
    template_name = 'accounts/register.html'
    if request.method == 'POST':
        is_professor = request.POST.get('is_professor', '')
        if is_professor:
            form = RegisterProfessorForm(request.POST)
        else:
            form = RegisterForm(request.POST)
        if form.is_valid():
            user = form.save()
            user = authenticate(
                username=user.username,
                password=form.cleaned_data['<PASSWORD>']
            )
            login(request, user)
            return redirect('core:home')
    else:
        form = RegisterForm()
    context = {
        'form': form
    }
    return render(request, template_name, context)


@login_required
def dashboard(request):
    template_name = 'accounts/dashboard.html'
    return render(request, template_name)


def password_reset(request):
    template_name = 'accounts/password_reset.html'
    context = {}
    form = PasswordResetForm(request.POST or None)
    if form.is_valid():
        form.save()
        context['success'] = True
{'fraction_non_alphanumeric': 0.09087926509186352, 'fraction_numerical': 0.001968503937007874, 'mean_word_length': 3.059920106524634, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '1978691', 'n_tokens_mistral': 857, 'n_tokens_neox': 817, 'n_words': 201}