From c50595303bd69f47168c5023d440069613346a85 Mon Sep 17 00:00:00 2001 From: Adarnof Date: Sun, 31 Jan 2016 18:02:20 +0000 Subject: [PATCH] Corrected key validation --- celerytask/tasks.py | 1 - eveonline/forms.py | 5 ++--- services/managers/eve_api_manager.py | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/celerytask/tasks.py b/celerytask/tasks.py index 595f2811..0de6a488 100755 --- a/celerytask/tasks.py +++ b/celerytask/tasks.py @@ -395,7 +395,6 @@ def run_api_refresh(): api_key_pairs = EveManager.get_api_key_pairs(user.id) logger.debug("User %s has api key pairs %s" % (user, api_key_pairs)) if api_key_pairs: - valid_key = False authserviceinfo, c = AuthServicesInfo.objects.get_or_create(user=user) logger.debug("User %s has api keys. Proceeding to refresh." % user) for api_key_pair in api_key_pairs: diff --git a/eveonline/forms.py b/eveonline/forms.py index a4fb4c17..fc9f8c45 100644 --- a/eveonline/forms.py +++ b/eveonline/forms.py @@ -21,7 +21,6 @@ class UpdateKeyForm(forms.Form): super(UpdateKeyForm, self).clean() if 'api_id' in self.cleaned_data and 'api_key' in self.cleaned_data: - logger.debug("Form has id and key") 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') @@ -40,8 +39,8 @@ class UpdateKeyForm(forms.Form): if 'MEMBER' in states: if EveApiManager.validate_member_api(self.cleaned_data['api_id'], self.cleaned_data['api_key']) is False: - raise forms.ValidationError(u'API does not meet requirements: account: %s mask: %s' % (settings.MEMBER_API_ACCOUNT, settings.MEMBER_API_MASK)) + raise forms.ValidationError(u'API does not meet member requirements: account: %s mask: %s' % (settings.MEMBER_API_ACCOUNT, settings.MEMBER_API_MASK)) if 'BLUE' in states: if EveApiManager.validate_blue_api(self.cleaned_data['api_id'], self.cleaned_data['api_key']) is False: - raise forms.ValidationError(u'API does not meet requirements: account: %s mask: %s' % (settings.BLUE_API_ACCOUNT, settings.BLUE_API_MASK)) + raise forms.ValidationError(u'API does not meet blue requirements: account: %s mask: %s' % (settings.BLUE_API_ACCOUNT, settings.BLUE_API_MASK)) return self.cleaned_data diff --git a/services/managers/eve_api_manager.py b/services/managers/eve_api_manager.py index 6d6f75d3..dea84cd1 100644 --- a/services/managers/eve_api_manager.py +++ b/services/managers/eve_api_manager.py @@ -271,7 +271,7 @@ class EveApiManager(): @staticmethod def validate_member_api(api_id, api_key): if settings.MEMBER_API_ACCOUNT: - if EveApiManager.check_if_api_is_type_account(api_id, api_key) is not True: + if EveApiManager.check_api_is_type_account(api_id, api_key) is not True: logger.debug("Api id %s is not type account as required for members - failed validation." % api_id) return False @@ -283,7 +283,7 @@ class EveApiManager(): @staticmethod def validate_blue_api(api_id, api_key): if settings.BLUE_API_ACCOUNT: - if EveApiManager.check_if_api_is_type_account(api_id, api_key) is not True: + if EveApiManager.check_api_is_type_account(api_id, api_key) is not True: logger.debug("Api id %s is not type account as required for blues - failed validation." % api_id) return False if EveApiManager.check_blue_api_is_full(api_id, api_key) is not True: