mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #17279: Do not regenerate key when updating a token via REST API
This commit is contained in:
parent
07b1362b5e
commit
8282a6ddfe
@ -40,7 +40,7 @@ class TokenSerializer(ValidatedModelSerializer):
|
||||
brief_fields = ('id', 'url', 'display', 'key', 'write_enabled', 'description')
|
||||
|
||||
def to_internal_value(self, data):
|
||||
if 'key' not in data:
|
||||
if not getattr(self.instance, 'key', None) and 'key' not in data:
|
||||
data['key'] = Token.generate_key()
|
||||
return super().to_internal_value(data)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user