mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Check the input is a valid integer
This commit is contained in:
@@ -26,6 +26,11 @@ class EveAPIForm(forms.Form):
|
|||||||
if not 'user_id' in self.cleaned_data or self.cleaned_data['user_id'] == '':
|
if not 'user_id' in self.cleaned_data or self.cleaned_data['user_id'] == '':
|
||||||
raise forms.ValidationError("Please provide a valid User ID")
|
raise forms.ValidationError("Please provide a valid User ID")
|
||||||
|
|
||||||
|
try:
|
||||||
|
int(self.cleaned_data['user_id'])
|
||||||
|
except ValueError:
|
||||||
|
raise forms.ValidationError("Please provide a valid user ID.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['user_id'])
|
eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['user_id'])
|
||||||
except EVEAccount.DoesNotExist:
|
except EVEAccount.DoesNotExist:
|
||||||
|
|||||||
Reference in New Issue
Block a user