mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Refreshing your API key on your profile now uses a ajax request.
This commit is contained in:
BIN
media/img/spinner.gif
Normal file
BIN
media/img/spinner.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 673 B |
@@ -107,7 +107,6 @@ def eveapi_refresh(request, userid=0):
|
|||||||
import_eve_account(acc.api_key, acc.api_user_id, force_cache=True)
|
import_eve_account(acc.api_key, acc.api_user_id, force_cache=True)
|
||||||
request.user.get_profile().update_access()
|
request.user.get_profile().update_access()
|
||||||
|
|
||||||
print request.GET
|
|
||||||
if request.is_ajax():
|
if request.is_ajax():
|
||||||
acc = EVEAccount.objects.get(id=userid)
|
acc = EVEAccount.objects.get(id=userid)
|
||||||
return HttpResponse(serializers.serialize('json', [acc]), mimetype='application/javascript')
|
return HttpResponse(serializers.serialize('json', [acc]), mimetype='application/javascript')
|
||||||
|
|||||||
@@ -6,6 +6,19 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function refresh_apikey(key) {
|
||||||
|
$("#api-time-" + key).html("<center><img src='/static/img/spinner.gif'/></center>");
|
||||||
|
$.getJSON("/profile/refresh/eveapi/" + key + "/", function(json) {
|
||||||
|
$("#api-time-" + json[0].fields.api_user_id).html("a moment ago");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<h1>Your Profile</h1>
|
<h1>Your Profile</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -72,8 +85,9 @@ setup.</p>
|
|||||||
<td>{{ acc.description }}</td>
|
<td>{{ acc.description }}</td>
|
||||||
<td>{{ acc.get_api_keytype_display }}</td>
|
<td>{{ acc.get_api_keytype_display }}</td>
|
||||||
<td>{{ acc.get_api_status_display }}</td>
|
<td>{{ acc.get_api_status_display }}</td>
|
||||||
<td>{{ acc.api_last_updated|naturaltimediff }}</td>
|
<td id="api-time-{{ acc.api_user_id }}">{{ acc.api_last_updated|naturaltimediff }}</td>
|
||||||
<td><a href="{% url sso.views.eveapi_refresh acc.api_user_id %}">Refresh</a>,
|
<td><a href="javascript:refresh_apikey({{ acc.api_user_id }})">Refresh (AJAX)</a>,
|
||||||
|
<a href="{% url sso.views.eveapi_refresh acc.api_user_id %}">Refresh</a>,
|
||||||
<a href="{% url sso.views.eveapi_log acc.api_user_id %}">Logs</a>,
|
<a href="{% url sso.views.eveapi_log acc.api_user_id %}">Logs</a>,
|
||||||
<a href="{% url sso.views.eveapi_del acc.api_user_id %}">Delete</a></td>
|
<a href="{% url sso.views.eveapi_del acc.api_user_id %}">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user