-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #590 from CTPUG/problematic-usernames
Disallow problematic usernames
- Loading branch information
Showing
6 changed files
with
34 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
wafer/registration/templates/registration/registration_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
{% extends 'wafer/base_form.html' %} | ||
{% load i18n %} | ||
{% load crispy_forms_tags %} | ||
{% load wafer_crispy %} | ||
{% block content %} | ||
<h1>{% trans 'Sign up' %}</h1> | ||
{% wafer_form_helper 'wafer.registration.forms.RegistrationFormHelper' as form_helper %} | ||
{% crispy form form_helper %} | ||
{% crispy form %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.core.exceptions import ValidationError | ||
|
||
|
||
def validate_username(username): | ||
"""Some usernames lead to problematic URLs and static file names""" | ||
if username.startswith('.'): | ||
raise ValidationError('usernames cannot start with a "."') | ||
if username in ('index.html', 'page'): | ||
raise ValidationError('This username is not available') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters