mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-05 14:56:24 -06:00
Initial work on REST API endpoint for tokens
This commit is contained in:
@@ -216,7 +216,8 @@ class Token(BigIDModel):
|
||||
self.key = self.generate_key()
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def generate_key(self):
|
||||
@staticmethod
|
||||
def generate_key():
|
||||
# Generate a random 160-bit key expressed in hexadecimal.
|
||||
return binascii.hexlify(os.urandom(20)).decode()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user