Update sso templates and a few minor issues

This commit is contained in:
2011-12-04 18:34:16 +00:00
parent 7043646ba1
commit 8ad4634fe7
11 changed files with 115 additions and 122 deletions

View File

@@ -29,7 +29,8 @@ class BaseService():
settings = { 'require_user': True,
'require_password': True,
'provide_login': False }
'provide_login': False,
'use_auth_username': True, }
def add_user(self, username, password, **kwargs):
""" Add a user, returns a dict for that user """

View File

@@ -1,19 +1,22 @@
{% extends "base.html" %}
{% block title %}External Auth API Services Password Reset{% endblock %}
{% block title %}Change Services Password{% endblock %}
{% block content %}
<div class="page-header">
<h1>Change Services Password</h1>
</div>
<p>This service will reset your password for all External Auth API Services. If you wish to continue please enter a new
password below.</p>
<form action="{% url sso.views.set_apipasswd %}" method="post">
<table>
{{ form.as_table }}
</table>
<br />
<formset>
{% include "formtools/formfield.html" with field=form.password %}
{% csrf_token %}
<input type="submit" value="Reset Account" />
<input type="submit" value="Reset Account" class="btn primary" />
</formset>
</form>
{% endblock %}

View File

@@ -9,11 +9,10 @@
<form action="" method="post">
<fieldset>
<table>
{{ form.as_table }}
</table>
{% include "formtools/formfield.html" with field=form.email1 %}
{% include "formtools/formfield.html" with field=form.email2 %}
{% csrf_token %}
<input type="submit" value="Change Email" class="btn"/>
<input type="submit" value="Change Email" class="btn primary"/>
</fieldset>
</form>

View File

@@ -8,12 +8,11 @@
<p>Your primary character is used across auth services to show as your display name and corporation. Please set this to which character you consider your "main".</p>
<form action="" method="post">
<table>
{{ form.as_table }}
</table>
<br />
<fieldset>
{% include "formtools/formfield.html" with field=form.character %}
{% csrf_token %}
<input type="submit" value="Change" />
<input type="submit" value="Change" class="btn primary" />
</fieldset>
</form>
{% endblock %}

View File

@@ -48,8 +48,11 @@
<h2>Service Accounts</h2>
<p>These are services that cannot talk to auth and require a seperate username/password.</p>
{% if user.serviceaccount_set.all %}
<table>
<table class="zebra-striped" id="services">
<thead>
<tr><th>Service</th><th>Username</th><th>URL</th><th>Active</th><th>Actions</th></tr>
</thead>
<tbody>
{% for acc in user.serviceaccount_set.all %}
<tr><td>{{ acc.service }}</td>
<td>{{ acc.service_uid }}</td>
@@ -59,13 +62,12 @@
{% if acc.active %}
{% if acc.service.settings.require_password %}<a href="{% url sso.views.service_reset acc.id %}">Reset</a>&nbsp;/&nbsp;{% endif %}
<a href="{% url sso.views.service_del acc.id %}">Delete</a>
{% if acc.service.provide_login %}
&nbsp;/&nbsp;<a href="{% url sso.views.service_login acc.id %}">Login</a>
{% endif %}
{% if acc.service.provide_login %}&nbsp;/&nbsp;<a href="{% url sso.views.service_login acc.id %}">Login</a>{% endif %}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<p>
@@ -93,7 +95,7 @@
<td>{{ acc.api_user_id }}</td>
<td>{{ acc.api_key|slice:":10" }}&#8230;</td>
<td>{{ acc.description }}</td>
<td><a href="#" class="accesspopup" id="{{ acc.api_user_id}}" data-original-title="Access for Key {{ acc.api_user_id }}" data-content="test" rel="popover">{{ acc.get_api_keytype_display }}</a>{% if acc.api_keytype == 4 %}&nbsp;<b><sup style="color: red;">*</sup></b>{% endif %}</td>
<td><a href="#" class="accesspopup" id="{{ acc.api_user_id}}" data-original-title="Access for Key {{ acc.api_user_id }}" rel="popover">{{ acc.get_api_keytype_display }}</a>{% if acc.api_keytype == 4 %}&nbsp;<b><sup style="color: red;">*</sup></b>{% endif %}</td>
<td id="api-status-{{ acc.api_user_id }}">{{ acc.get_api_status_display }}</td>
<td id="api-time-{{ acc.api_user_id }}">{{ acc.api_last_updated|naturaltimediff }}</td>
<td>{% ifswitch api-disableprocessing %}{% else %}<a href="{% url eve_api.views.eveapi_refresh acc.api_user_id %}" onclick="javascript:refresh_apikey({{ acc.api_user_id }}); return false;">Refresh</a>,&nbsp;
@@ -115,34 +117,6 @@
<a href="{% url sso.views.refresh_access %}" class="btn {% if not user.eveaccount_set.all %}disabled{% else %}danger{% endif %}" title="Forces auth to recheck your permissions and update your services as needed">Force Access Update</a>
{% endifswitch %}
</p>
<script type="text/javascript">
function refresh_apikey(key) {
$("#api-status-" + key).html("<center><img src='{{ STATIC_URL }}img/spinner.gif'/></center>");
$("#api-time-" + key).html("<center><img src='{{ STATIC_URL }}img/spinner.gif'/></center>");
$.getJSON("/eve/eveapi/refresh/" + key + "/", function(json) {
$("#api-time-" + json[0].pk).html("a moment ago");
switch(json[0].fields.api_status) {
case 0:
$("#api-status-" + json[0].pk).html("Unknown");
break;
case 1:
$("#api-status-" + json[0].pk).html("OK");
break;
case 2:
$("#api-status-" + json[0].pk).html("Other Error");
break;
case 3:
$("#api-status-" + json[0].pk).html("Account Expired");
break;
default:
$("#api-status-" + json[0].pk).html("Error");
break;
}
});
}
</script>
</div>
{% if "reddit"|installed %}
@@ -185,6 +159,7 @@
e.preventDefault();
var el = $(this);
var id = $(this).attr('id');
if (!el.attr('data-content')) {
$.ajax({
type: 'GET',
url: '/eve/eveapi/access/' + id + '/',
@@ -194,13 +169,40 @@
el.popover('show');
},
});
} else {
el.popover('show');
}
}
$('.tabs').tabs();
$("table#eveapikeys").tablesorter({ sortList: [[0,0]] });
$('.accesspopup').popover({html: 'true', trigger: 'manual'});
$('.accesspopup').hover(access_popover, function () { $(this).popover('hide') });
function refresh_apikey(key) {
$("#api-status-" + key).html("<center><img src='{{ STATIC_URL }}img/spinner.gif'/></center>");
$("#api-time-" + key).html("<center><img src='{{ STATIC_URL }}img/spinner.gif'/></center>");
$.getJSON("/eve/eveapi/refresh/" + key + "/", function(json) {
$("#api-time-" + json[0].pk).html("a moment ago");
switch(json[0].fields.api_status) {
case 0:
$("#api-status-" + json[0].pk).html("Unknown");
break;
case 1:
$("#api-status-" + json[0].pk).html("OK");
break;
case 2:
$("#api-status-" + json[0].pk).html("Other Error");
break;
case 3:
$("#api-status-" + json[0].pk).html("Account Expired");
break;
default:
$("#api-status-" + json[0].pk).html("Error");
break;
}
});
}
</script>
{% endblock %}

View File

@@ -3,9 +3,12 @@
{% block title %}Add External Service Account{% endblock %}
{% block content %}
<div class="page-header">
<h1>Add Service</h1>
</div>
<p>To add a service to your account, select the service from the list
below
then provide select a username you wish to use create the account for<br/>
below then provide select a username you wish to use create the account for.
<br/>
For details on how to connect to each service, please consult the <a
href="http://wiki.dredd.it">wiki</a></p>
@@ -13,13 +16,13 @@ href="http://wiki.dredd.it">wiki</a></p>
<p>If you are missing some services, please check that your API key is
up to date, if so use the "Refresh" function.</p>
<form action="{% url sso.views.service_add serviceid %}" method="post">
<table>
{{ form.as_table }}
</table>
<br />
<input type="submit" value="Create Account" />
<form action="{% url sso.views.service_add %}" method="post">
<fieldset>
{% include "formtools/formfield.html" with field=form.character %}
{% include "formtools/formfield.html" with field=form.service %}
{% include "formtools/formfield.html" with field=form.password %}
{% csrf_token %}
</form>
<input type="submit" value="Create Account" />
</fieldset>
<br/>
{% endblock %}

View File

@@ -3,6 +3,11 @@
{% block title %}External Service Account{% endblock %}
{% block content %}
<div class="page-header">
<h1>Add Service</h1>
</div>
{% if error %}
<div style="border: 1px solid #FF0000; background: #FF7D7D; width: 100%; text-align: center;">
<b>Error:</b> Your account has not been created. Either you already have a user on this service or a error has occured. If you think

View File

@@ -1,25 +0,0 @@
{% extends "base.html" %}
{% block title %}Add External Service Account{% endblock %}
{% block content %}
<p>To add a service to your account, select the service from the list
below
then provide select a username you wish to use create the account for<br/>
<br/>
For details on how to connect to each service, please consult the <a
href="http://wiki.dredd.it">wiki</a></p>
<p>If you are missing some services, please check that your API key is
up to date, if so use the "Refresh" function.</p>
<form action="{% url sso.views.service_add %}" method="post">
<table>
{{ form.as_table }}
</table>
<br />
<input type="submit" value="Create Account" />
{% csrf_token %}
</form>
<br/>
{% endblock %}

View File

@@ -3,6 +3,10 @@
{% block title %}External Service Account{% endblock %}
{% block content %}
<div class="page-header">
<h1>Add Service</h1>
</div>
<p>You have no services available to add to your account</p>
<p>If this is unexpected, please check that your API key is correct. If

View File

@@ -1,18 +1,20 @@
{% extends "base.html" %}
{% block title %}External Service Account Password Reset{% endblock %}
{% block title %}Reset Service{% endblock %}
{% block content %}
<div class="page-header">
<h1>Reset Service</h1>
</div>
<p>This service will reset your password for account {{ acc.service_uid }} on {{ acc.service }}. If you wish to continue please click the link
below.</p>
<form action="{% url sso.views.service_reset serviceid %}" method="post">
<table>
{{ form.as_table }}
</table>
<fieldset>
{% include "formtools/formfield.html" with field=form.password %}
{% csrf_token %}
<input type="submit" value="Reset Account" />
<input type="submit" value="Reset Account" class="btn primary"/>
</fieldset>
</form>
{% endblock %}

View File

@@ -91,7 +91,7 @@ def service_add(request):
else:
form = clsform() # An unbound form
return render_to_response('sso/serviceaccount/index.html', locals(), context_instance=RequestContext(request))
return render_to_response('sso/serviceaccount/add.html', locals(), context_instance=RequestContext(request))
@login_required