Skip to content

Commit

Permalink
[#485] Update generate tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmursa-dev committed Dec 16, 2024
1 parent 44e935e commit 0cfd451
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/objects/token/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import binascii
import os
import secrets

from django.core import exceptions
from django.db import models
Expand Down Expand Up @@ -81,7 +80,7 @@ def save(self, *args, **kwargs):
return super().save(*args, **kwargs)

def generate_token(self):
return binascii.hexlify(os.urandom(20)).decode()
return secrets.token_hex(20)

def get_permission_for_object_type(self, object_type: ObjectType):
if not self.permissions.filter(object_type=object_type).exists():
Expand Down

0 comments on commit 0cfd451

Please sign in to comment.