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

merge-requests/154/head
Eliot Berriot 2018-03-24 20:31:36 +01:00
rodzic ae65190364
commit 4b69d64db2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
3 zmienionych plików z 27 dodań i 0 usunięć

Wyświetl plik

@ -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=[])

Wyświetl plik

@ -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 = {

Wyświetl plik

@ -0,0 +1 @@
We now restrict some usernames from being used during signup (#139)