Skip to content
Snippets Groups Projects
Verified Commit 4b69d64d authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fix #139: We now restrict some usernames from being used during signup

parent ae651903
No related branches found
No related tags found
No related merge requests found
......@@ -385,3 +385,12 @@ CSRF_USE_SESSIONS = True
# Playlist settings
PLAYLISTS_MAX_TRACKS = env.int('PLAYLISTS_MAX_TRACKS', default=250)
ACCOUNT_USERNAME_BLACKLIST = [
'funkwhale',
'root',
'admin',
'owner',
'superuser',
'staff',
] + env.list('ACCOUNT_USERNAME_BLACKLIST', default=[])
......@@ -23,6 +23,23 @@ def test_can_create_user_via_api(preferences, client, db):
assert u.username == 'test1'
def test_can_restrict_usernames(settings, preferences, db, client):
url = reverse('rest_register')
preferences['users__registration_enabled'] = True
settings.USERNAME_BLACKLIST = ['funkwhale']
data = {
'username': 'funkwhale',
'email': 'contact@funkwhale.io',
'password1': 'testtest',
'password2': 'testtest',
}
response = client.post(url, data)
assert response.status_code == 400
assert 'username' in response.data
def test_can_disable_registration_view(preferences, client, db):
url = reverse('rest_register')
data = {
......
We now restrict some usernames from being used during signup (#139)
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