mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Don't presave invalid account details
This commit is contained in:
@@ -103,7 +103,7 @@ def import_apikey_func(api_userid, api_key, user=None, force_cache=False, log=lo
|
|||||||
# Create or retrieve the account last to make sure everything
|
# Create or retrieve the account last to make sure everything
|
||||||
# before here is good to go.
|
# before here is good to go.
|
||||||
account, created = EVEAccount.objects.get_or_create(api_user_id=api_userid)
|
account, created = EVEAccount.objects.get_or_create(api_user_id=api_userid)
|
||||||
if not created and 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_keytype = API_KEYTYPE_UNKNOWN
|
account.api_keytype = API_KEYTYPE_UNKNOWN
|
||||||
account.api_status = API_STATUS_OK
|
account.api_status = API_STATUS_OK
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ def eveapi_add(request, post_save_redirect='/', template='eve_api/add.html'):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = EveAPIForm(request.POST)
|
form = EveAPIForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
|
||||||
acc = form.save()
|
|
||||||
task = import_apikey_result.delay(api_key=acc.api_key, api_userid=acc.api_user_id, user=request.user.id)
|
task = import_apikey_result.delay(api_key=acc.api_key, api_userid=acc.api_user_id, user=request.user.id)
|
||||||
try:
|
try:
|
||||||
task.wait(10)
|
task.wait(10)
|
||||||
@@ -62,9 +60,6 @@ def eveapi_update(request, userid, post_save_redirect='/', template='eve_api/upd
|
|||||||
form = EveAPIForm(request.POST, instance=acc)
|
form = EveAPIForm(request.POST, instance=acc)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
if form.has_changed() and ('api_key' in form.changed_data):
|
if form.has_changed() and ('api_key' in form.changed_data):
|
||||||
#acc = form.save()
|
|
||||||
acc.api_keytype = API_KEYTYPE_UNKNOWN
|
|
||||||
acc.save()
|
|
||||||
task = import_apikey_result.delay(api_key=acc.api_key, api_userid=acc.api_user_id, user=request.user.id)
|
task = import_apikey_result.delay(api_key=acc.api_key, api_userid=acc.api_user_id, user=request.user.id)
|
||||||
try:
|
try:
|
||||||
task.wait(30)
|
task.wait(30)
|
||||||
|
|||||||
Reference in New Issue
Block a user