mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-15 07:20:17 +02:00
Corrected key validation
This commit is contained in:
parent
49d1b86566
commit
c50595303b
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user