From f9b0c271b4ae9453f679d1a8edf82d9f2483cc2b Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 3 Mar 2010 15:15:19 +0000 Subject: [PATCH] Further validation of Eve API keys --- sso/forms.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sso/forms.py b/sso/forms.py index 4a7f75a..e1710e4 100644 --- a/sso/forms.py +++ b/sso/forms.py @@ -5,13 +5,13 @@ from sso.models import ServiceAccount, Service from reddit.models import RedditAccount class EveAPIForm(forms.Form): - user_id = forms.CharField(label = u'User ID', max_length=10) - api_key = forms.CharField(label = u'API Key', max_length=100) + user_id = forms.IntegerField(label = u'User ID') + api_key = forms.CharField(label = u'API Key', max_length=64) description = forms.CharField(max_length=100) def clean(self): - if not self.cleaned_data['user_id'].isdigit(): - raise forms.ValidationError("API User ID provided is not valid") + if not self.cleaned_data['api_key'].len() == 64: + raise forms.ValidationError("API Key provided is invalid (Not 64 characters long)") try: eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['user_id'])