From 6bbea6eedadcc0814235ec30a93a3a3e5993995e Mon Sep 17 00:00:00 2001 From: Adarnof Date: Thu, 18 Feb 2016 20:25:43 +0000 Subject: [PATCH] Added check to ensure api is valid before pulling characters --- eveonline/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eveonline/forms.py b/eveonline/forms.py index 01c51849..eeba2f9e 100644 --- a/eveonline/forms.py +++ b/eveonline/forms.py @@ -24,7 +24,8 @@ class UpdateKeyForm(forms.Form): if EveManager.check_if_api_key_pair_exist(self.cleaned_data['api_id']): logger.debug("UpdateKeyForm failed cleaning as API id %s already exists." % self.cleaned_data['api_id']) raise forms.ValidationError(u'API key already exist') - + if EveApiManager.api_key_is_valid(self.cleaned_data['api_id'], self.cleaned_data['api_key']) is False: + raise forms.ValidationError(u'API key is invalid') chars = EveApiManager.get_characters_from_api(self.cleaned_data['api_id'], self.cleaned_data['api_key']).result states = [] states.append(self.user_state)