mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
Added requirement for full api key
This commit is contained in:
parent
1ee3fbb59f
commit
0ac78b25d8
@ -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
|
@ -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:
|
||||
|
@ -14,12 +14,8 @@
|
||||
<div class="col-md-4 col-md-offset-4">
|
||||
<div class="row">
|
||||
<p class="text-center">
|
||||
The minimum permission required for
|
||||
Alliance services: CharacterInfo
|
||||
Full API Key is required for auth services
|
||||
</p>
|
||||
<p class="text-center">
|
||||
<a target="_blank" href="https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=115878208">Create a standard API key</a>
|
||||
<br/>
|
||||
<a target="_blank" href="https://community.eveonline.com/support/api-key/CreatePredefined?accessMask=268435455">Create a full API key</a>
|
||||
</p>
|
||||
<form class="form-signin" role="form" action="{% url 'auth_add_api_key' %}" method="POST">
|
||||
|
Loading…
x
Reference in New Issue
Block a user