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

Fix #198: Removed Python 3.6 dependency (secrets module)

parent db4c1356
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import binascii
import os
import uuid
import secrets
from django.conf import settings
from django.contrib.auth.models import AbstractUser
......@@ -14,6 +15,10 @@ from django.utils.translation import ugettext_lazy as _
from funkwhale_api.common import fields
def get_token():
return binascii.b2a_hex(os.urandom(15)).decode('utf-8')
@python_2_unicode_compatible
class User(AbstractUser):
......@@ -58,7 +63,7 @@ class User(AbstractUser):
return self.secret_key
def update_subsonic_api_token(self):
self.subsonic_api_token = secrets.token_hex(32)
self.subsonic_api_token = get_token()
return self.subsonic_api_token
def set_password(self, raw_password):
......
Removed Python 3.6 dependency (secrets module) (#198)
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