updated error handling and message for key tag

This commit is contained in:
David Kennedy 2025-03-20 16:27:17 -04:00
parent 42ae02a2d4
commit 5ae613fba3
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 2 additions and 2 deletions

View file

@ -680,7 +680,7 @@ class DomainDsdataForm(forms.Form):
key_tag = cleaned_data.get("key_tag", 0) key_tag = cleaned_data.get("key_tag", 0)
try: try:
key_tag = int(key_tag) key_tag = int(key_tag)
if key_tag < 0 or key_tag > 65535: if key_tag <= 0 or key_tag > 65535:
self.add_error( self.add_error(
"key_tag", "key_tag",
DsDataError(code=DsDataErrorCodes.INVALID_KEYTAG_SIZE), DsDataError(code=DsDataErrorCodes.INVALID_KEYTAG_SIZE),

View file

@ -262,7 +262,7 @@ class DsDataError(Exception):
DsDataErrorCodes.INVALID_DIGEST_SHA1: ("SHA-1 digest must be exactly 40 characters."), DsDataErrorCodes.INVALID_DIGEST_SHA1: ("SHA-1 digest must be exactly 40 characters."),
DsDataErrorCodes.INVALID_DIGEST_SHA256: ("SHA-256 digest must be exactly 64 characters."), DsDataErrorCodes.INVALID_DIGEST_SHA256: ("SHA-256 digest must be exactly 64 characters."),
DsDataErrorCodes.INVALID_DIGEST_CHARS: ("Digest must contain only alphanumeric characters (0-9, a-f)."), DsDataErrorCodes.INVALID_DIGEST_CHARS: ("Digest must contain only alphanumeric characters (0-9, a-f)."),
DsDataErrorCodes.INVALID_KEYTAG_SIZE: ("Key tag must be less than 65535."), DsDataErrorCodes.INVALID_KEYTAG_SIZE: ("Key tag must be greater than 0 and less than 65535."),
DsDataErrorCodes.INVALID_KEYTAG_CHARS: ("Key tag must be numeric (0-9)."), DsDataErrorCodes.INVALID_KEYTAG_CHARS: ("Key tag must be numeric (0-9)."),
} }