mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 18:09:33 +02:00
More secure tokens
This commit is contained in:
parent
f2e5969c44
commit
30f6a77e68
2 changed files with 4 additions and 5 deletions
|
@ -1,9 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import binascii
|
||||
import datetime
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
import uuid
|
||||
|
@ -31,8 +29,9 @@ from funkwhale_api.federation import models as federation_models
|
|||
from funkwhale_api.federation import utils as federation_utils
|
||||
|
||||
|
||||
def get_token(length=15):
|
||||
return binascii.b2a_hex(os.urandom(length)).decode("utf-8")
|
||||
def get_token(length=30):
|
||||
choices = string.ascii_lowercase + string.ascii_uppercase + "0123456789"
|
||||
return "".join(random.choice(choices) for i in range(length))
|
||||
|
||||
|
||||
PERMISSIONS_CONFIGURATION = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue