diff --git a/docs/release-notes/version-3.4.md b/docs/release-notes/version-3.4.md index 5903ec004..cec86665c 100644 --- a/docs/release-notes/version-3.4.md +++ b/docs/release-notes/version-3.4.md @@ -10,6 +10,7 @@ ### Bug Fixes * [#11383](https://github.com/netbox-community/netbox/issues/11383) - Fix ordering of global search results by object type +* [#12238](https://github.com/netbox-community/netbox/issues/12238) - Improve error message for API token IP prefix validation failures * [#12255](https://github.com/netbox-community/netbox/issues/12255) - Restore the ability to move inventory items among devices * [#12270](https://github.com/netbox-community/netbox/issues/12270) - Fix pre-population of list values when creating a saved filter * [#12296](https://github.com/netbox-community/netbox/issues/12296) - Fix "mark connected" form field for bulk editing front & rear ports diff --git a/netbox/users/forms.py b/netbox/users/forms.py index e8647aa5f..c87d5868b 100644 --- a/netbox/users/forms.py +++ b/netbox/users/forms.py @@ -6,6 +6,7 @@ from django.utils.html import mark_safe from django.utils.translation import gettext as _ from ipam.formfields import IPNetworkFormField +from ipam.validators import prefix_validator from netbox.preferences import PREFERENCES from utilities.forms import BootstrapMixin, DateTimePicker, StaticSelect from utilities.utils import flatten_dict @@ -104,7 +105,7 @@ class TokenForm(BootstrapMixin, forms.ModelForm): help_text=_("If no key is provided, one will be generated automatically.") ) allowed_ips = SimpleArrayField( - base_field=IPNetworkFormField(), + base_field=IPNetworkFormField(validators=[prefix_validator]), required=False, label=_('Allowed IPs'), help_text=_('Allowed IPv4/IPv6 networks from where the token can be used. Leave blank for no restrictions. '