mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-04 14:16:21 +01:00
Ensure entered api ID is int
Auth accepts these values in either order for building the model, but incorrectly assigns the vcode instead of ID to character models if entered incorrectly which can break certain functions. This is an added layer of stupid-protection to make sure they put the API ID (a number) in the right field.
This commit is contained in:
@@ -16,6 +16,13 @@ class UpdateKeyForm(forms.Form):
|
||||
|
||||
api_id = forms.CharField(max_length=254, required=True, label="Key ID")
|
||||
api_key = forms.CharField(max_length=254, required=True, label="Verification Code")
|
||||
|
||||
def clean_api_id(self):
|
||||
try:
|
||||
api_id = int(self.cleaned_data['api_id'])
|
||||
return api_id
|
||||
except:
|
||||
raise forms.ValidationError("API ID must be a number")
|
||||
|
||||
def clean(self):
|
||||
super(UpdateKeyForm, self).clean()
|
||||
|
||||
Reference in New Issue
Block a user