diff --git a/eveonline/forms.py b/eveonline/forms.py index 3e66e054..4dcb5e23 100644 --- a/eveonline/forms.py +++ b/eveonline/forms.py @@ -15,4 +15,8 @@ class UpdateKeyForm(forms.Form): self.cleaned_data['api_key']): raise forms.ValidationError(u'API not of type account') + if not EveApiManager.check_api_is_full(self.cleaned_data['api_id'], + self.cleaned_data['api_key']): + raise forms.ValidationError(u'API supplied is not a full api key') + return self.cleaned_data \ No newline at end of file diff --git a/services/managers/eve_api_manager.py b/services/managers/eve_api_manager.py index 18084bfe..d010a1c1 100644 --- a/services/managers/eve_api_manager.py +++ b/services/managers/eve_api_manager.py @@ -47,6 +47,21 @@ class EveApiManager(): return False + + @staticmethod + def check_api_is_full(api_id, api_key): + try: + api = evelink.api.API(api_key=(api_id, api_key)) + account = evelink.account.Account(api=api) + info = account.key_info() + return info[0]['access_mask'] == "268435455" + + except evelink.api.APIError as error: + print error + + return False + + @staticmethod def get_api_info(api_id, api_key): try: diff --git a/templates/registered/addapikey.html b/templates/registered/addapikey.html index 9f809683..023e209f 100644 --- a/templates/registered/addapikey.html +++ b/templates/registered/addapikey.html @@ -14,12 +14,8 @@

- The minimum permission required for - Alliance services: CharacterInfo + Full API Key is required for auth services

-

- Create a standard API key -
Create a full API key