SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 09fa1be4 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add UnicodeUsernameValidator to username field in registration form

parent ac34033b
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ from django import forms ...@@ -8,6 +8,7 @@ from django import forms
from django.contrib.auth import authenticate from django.contrib.auth import authenticate
from django.contrib.auth.models import User, Group from django.contrib.auth.models import User, Group
from django.contrib.auth.password_validation import validate_password from django.contrib.auth.password_validation import validate_password
from django.contrib.auth.validators import UnicodeUsernameValidator
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.db.models import Q from django.db.models import Q
...@@ -98,7 +99,8 @@ class RegistrationForm(forms.Form): ...@@ -98,7 +99,8 @@ class RegistrationForm(forms.Form):
personalwebpage = forms.URLField( personalwebpage = forms.URLField(
label='Personal web page', required=False, label='Personal web page', required=False,
widget=forms.TextInput({'placeholder': 'full URL, e.g. http://www.[yourpage].com'})) widget=forms.TextInput({'placeholder': 'full URL, e.g. http://www.[yourpage].com'}))
username = forms.CharField(label='* Username', max_length=100) username = forms.CharField(label='* Username', max_length=100,
validators=[UnicodeUsernameValidator,])
password = forms.CharField(label='* Password', widget=forms.PasswordInput()) password = forms.CharField(label='* Password', widget=forms.PasswordInput())
password_verif = forms.CharField(label='* Verify password', widget=forms.PasswordInput(), password_verif = forms.CharField(label='* Verify password', widget=forms.PasswordInput(),
help_text='Your password must contain at least 8 characters') help_text='Your password must contain at least 8 characters')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment