mirror of
https://github.com/nikdoof/test-auth.git
synced 2026-01-30 16:08:14 +00:00
Allow for EVE API key claiming if they're already in the DB. - Thanks Dorijan and Nil'kandra
This commit is contained in:
@@ -51,7 +51,7 @@ class EveAPIForm(forms.ModelForm):
|
|||||||
raise forms.ValidationError("You cannot change your API User ID")
|
raise forms.ValidationError("You cannot change your API User ID")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['api_user_id'])
|
eaccount = EVEAccount.objects.get(api_user_id=self.cleaned_data['api_user_id'], user__isnull=False)
|
||||||
except EVEAccount.DoesNotExist:
|
except EVEAccount.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ def import_apikey_func(api_userid, api_key, user=None, force_cache=False, log=lo
|
|||||||
if not 'error' in doc:
|
if not 'error' in doc:
|
||||||
if not account:
|
if not account:
|
||||||
account, created = EVEAccount.objects.get_or_create(pk=api_userid)
|
account, created = EVEAccount.objects.get_or_create(pk=api_userid)
|
||||||
if user:
|
if user and not account.user:
|
||||||
account.user = User.objects.get(id=user)
|
account.user = User.objects.get(id=user)
|
||||||
if not account.api_key == api_key:
|
if not account.api_key == api_key:
|
||||||
account.api_key = api_key
|
account.api_key = api_key
|
||||||
account.api_status = API_STATUS_OK
|
account.api_status = API_STATUS_OK
|
||||||
|
|||||||
Reference in New Issue
Block a user