Merge branch '1269-subsonic-passphrase' into 'develop'

Replaced token password with passphrase

Closes #1269

See merge request funkwhale/funkwhale!1232
This commit is contained in:
Agate 2020-11-15 21:44:23 +01:00
commit 800105e2e6
3 changed files with 1306 additions and 3 deletions

View File

@ -2,6 +2,7 @@
from __future__ import absolute_import, unicode_literals
import datetime
import os
import random
import string
import uuid
@ -29,9 +30,14 @@ from funkwhale_api.federation import models as federation_models
from funkwhale_api.federation import utils as federation_utils
def get_token(length=30):
choices = string.ascii_lowercase + string.ascii_uppercase + "0123456789"
return "".join(random.choice(choices) for i in range(length))
def get_token(length=5):
wordlist_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "wordlist.txt"
)
with open(wordlist_path, "r") as f:
words = f.readlines()
phrase = "".join(random.choice(words) for i in range(length))
return phrase.replace("\n", "-").rstrip("-")
PERMISSIONS_CONFIGURATION = {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
More user-friendly subsonic tokens (#1269)