From 1fc6b24ea5cf66ecca1ed48a036d1a89d0884094 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 10 Apr 2010 22:44:54 +0100 Subject: [PATCH] Further validation done on EVE API key input --- sso/forms.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sso/forms.py b/sso/forms.py index cc1eeb5..2e475a0 100644 --- a/sso/forms.py +++ b/sso/forms.py @@ -16,8 +16,13 @@ class EveAPIForm(forms.Form): description = forms.CharField(max_length=100, required=False) def clean(self): - if not len(self.cleaned_data['api_key']) == 64: + + if not 'api_key' in self.cleaned_data or not len(self.cleaned_data['api_key']) == 64: raise forms.ValidationError("API Key provided is invalid (Not 64 characters long)") + + if not 'user_id' in self.cleaned_data: + raise forms.ValidationError("Please provide a valid User ID") + try: eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['user_id']) except EVEAccount.DoesNotExist: