Commit e948e60b authored by Daniel Albert's avatar Daniel Albert

Limit username length to 30 characters, to prevent spamming the „watch“ screen

parent f6e63085
......@@ -6,9 +6,15 @@ from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from core.models import get_user_profile
class MyUserCreationForm(UserCreationForm):
username = forms.CharField(
max_length=30,
help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
)
def signup(request):
if request.method == 'POST':
form = UserCreationForm(request.POST)
form = MyUserCreationForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('username')
......@@ -17,7 +23,7 @@ def signup(request):
login(request, user)
return redirect('snake_create')
else:
form = UserCreationForm()
form = MyUserCreationForm()
return render(request, 'signup.html', {'form': form})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment