kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Merge branch '139-restrict-usernames' into 'develop'
Resolve "Allow restricting allowed usernames" Closes #139 See merge request funkwhale/funkwhale!107merge-requests/154/head
commit
952407d173
|
@ -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 = {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
We now restrict some usernames from being used during signup (#139)
|
Ładowanie…
Reference in New Issue