From 8ad4634fe766719ac666538949b797f577a04141 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 4 Dec 2011 18:34:16 +0000 Subject: [PATCH] Update sso templates and a few minor issues --- app/sso/services/__init__.py | 3 +- app/sso/templates/sso/apipassword.html | 17 +-- app/sso/templates/sso/emailchange.html | 13 +- app/sso/templates/sso/primarycharchange.html | 11 +- app/sso/templates/sso/profile.html | 118 +++++++++--------- app/sso/templates/sso/serviceaccount/add.html | 23 ++-- .../templates/sso/serviceaccount/created.html | 5 + .../templates/sso/serviceaccount/index.html | 25 ---- .../sso/serviceaccount/noneavailable.html | 4 + .../templates/sso/serviceaccount/reset.html | 16 +-- app/sso/views.py | 2 +- 11 files changed, 115 insertions(+), 122 deletions(-) delete mode 100644 app/sso/templates/sso/serviceaccount/index.html diff --git a/app/sso/services/__init__.py b/app/sso/services/__init__.py index 3b5bbde..8760886 100644 --- a/app/sso/services/__init__.py +++ b/app/sso/services/__init__.py @@ -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 """ diff --git a/app/sso/templates/sso/apipassword.html b/app/sso/templates/sso/apipassword.html index 7371fa6..3865f96 100644 --- a/app/sso/templates/sso/apipassword.html +++ b/app/sso/templates/sso/apipassword.html @@ -1,19 +1,22 @@ {% extends "base.html" %} -{% block title %}External Auth API Services Password Reset{% endblock %} +{% block title %}Change Services Password{% endblock %} {% block content %} + +

This service will reset your password for all External Auth API Services. If you wish to continue please enter a new password below.

- -{{ form.as_table }} -
-
-{% csrf_token %} - + + {% include "formtools/formfield.html" with field=form.password %} + {% csrf_token %} + +
{% endblock %} diff --git a/app/sso/templates/sso/emailchange.html b/app/sso/templates/sso/emailchange.html index 5f4d8f7..fecd04c 100644 --- a/app/sso/templates/sso/emailchange.html +++ b/app/sso/templates/sso/emailchange.html @@ -8,13 +8,12 @@
-
- - {{ form.as_table }} -
- {% csrf_token %} - -
+
+ {% include "formtools/formfield.html" with field=form.email1 %} + {% include "formtools/formfield.html" with field=form.email2 %} + {% csrf_token %} + +
{% endblock %} diff --git a/app/sso/templates/sso/primarycharchange.html b/app/sso/templates/sso/primarycharchange.html index 1ab6956..7d19ab7 100644 --- a/app/sso/templates/sso/primarycharchange.html +++ b/app/sso/templates/sso/primarycharchange.html @@ -8,12 +8,11 @@

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".

- -{{ form.as_table }} -
-
-{% csrf_token %} - +
+ {% include "formtools/formfield.html" with field=form.character %} + {% csrf_token %} + +
{% endblock %} diff --git a/app/sso/templates/sso/profile.html b/app/sso/templates/sso/profile.html index ff66f51..500858e 100644 --- a/app/sso/templates/sso/profile.html +++ b/app/sso/templates/sso/profile.html @@ -48,24 +48,26 @@

Service Accounts

These are services that cannot talk to auth and require a seperate username/password.

{% if user.serviceaccount_set.all %} - - - {% for acc in user.serviceaccount_set.all %} - - - - - - - {% endfor %} +
ServiceUsernameURLActiveActions
{{ acc.service }}{{ acc.service_uid }}{{ acc.service.url }}{% if acc.active %}Yes{% else %}No{% endif %} - {% if acc.active %} - {% if acc.service.settings.require_password %}Reset / {% endif %} - Delete - {% if acc.service.provide_login %} -  / Login - {% endif %} - {% endif %} -
+ + + + + {% for acc in user.serviceaccount_set.all %} + + + + + + + {% endfor %} +
ServiceUsernameURLActiveActions
{{ acc.service }}{{ acc.service_uid }}{{ acc.service.url }}{% if acc.active %}Yes{% else %}No{% endif %} + {% if acc.active %} + {% if acc.service.settings.require_password %}Reset / {% endif %} + Delete + {% if acc.service.provide_login %} / Login{% endif %} + {% endif %} +
{% endif %}

@@ -93,7 +95,7 @@ {{ acc.api_user_id }} {{ acc.api_key|slice:":10" }}… {{ acc.description }} - {{ acc.get_api_keytype_display }}{% if acc.api_keytype == 4 %} *{% endif %} + {{ acc.get_api_keytype_display }}{% if acc.api_keytype == 4 %} *{% endif %} {{ acc.get_api_status_display }} {{ acc.api_last_updated|naturaltimediff }} {% ifswitch api-disableprocessing %}{% else %}Refresh,  @@ -115,34 +117,6 @@ Force Access Update {% endifswitch %}

- - {% if "reddit"|installed %} @@ -185,22 +159,50 @@ e.preventDefault(); var el = $(this); var id = $(this).attr('id'); - $.ajax({ - type: 'GET', - url: '/eve/eveapi/access/' + id + '/', - dataType: 'html', - success: function(data) { - el.attr('data-content', data); - el.popover('show'); - }, - }); + if (!el.attr('data-content')) { + $.ajax({ + type: 'GET', + url: '/eve/eveapi/access/' + id + '/', + dataType: 'html', + success: function(data) { + el.attr('data-content', data); + 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("
"); + $("#api-time-" + key).html("
"); + $.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; + } + }); + } - - {% endblock %} diff --git a/app/sso/templates/sso/serviceaccount/add.html b/app/sso/templates/sso/serviceaccount/add.html index fd54a5f..a5b58f6 100644 --- a/app/sso/templates/sso/serviceaccount/add.html +++ b/app/sso/templates/sso/serviceaccount/add.html @@ -3,9 +3,12 @@ {% block title %}Add External Service Account{% endblock %} {% block content %} + +

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
+below then provide select a username you wish to use create the account for.
For details on how to connect to each service, please consult the wiki

@@ -13,13 +16,13 @@ href="http://wiki.dredd.it">wiki

If you are missing some services, please check that your API key is up to date, if so use the "Refresh" function.

-
- -{{ form.as_table }} -
-
- -{% csrf_token %} -
+
+
+ {% 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 %} + +

{% endblock %} diff --git a/app/sso/templates/sso/serviceaccount/created.html b/app/sso/templates/sso/serviceaccount/created.html index 4c75fa5..cf3347e 100644 --- a/app/sso/templates/sso/serviceaccount/created.html +++ b/app/sso/templates/sso/serviceaccount/created.html @@ -3,6 +3,11 @@ {% block title %}External Service Account{% endblock %} {% block content %} + + + {% if error %}
Error: Your account has not been created. Either you already have a user on this service or a error has occured. If you think diff --git a/app/sso/templates/sso/serviceaccount/index.html b/app/sso/templates/sso/serviceaccount/index.html deleted file mode 100644 index 0b40993..0000000 --- a/app/sso/templates/sso/serviceaccount/index.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Add External Service Account{% endblock %} - -{% block content %} -

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
-
-For details on how to connect to each service, please consult the wiki

- -

If you are missing some services, please check that your API key is -up to date, if so use the "Refresh" function.

- - - -{{ form.as_table }} -
-
- -{% csrf_token %} - -
-{% endblock %} diff --git a/app/sso/templates/sso/serviceaccount/noneavailable.html b/app/sso/templates/sso/serviceaccount/noneavailable.html index 7c28028..2cfd714 100644 --- a/app/sso/templates/sso/serviceaccount/noneavailable.html +++ b/app/sso/templates/sso/serviceaccount/noneavailable.html @@ -3,6 +3,10 @@ {% block title %}External Service Account{% endblock %} {% block content %} + +

You have no services available to add to your account

If this is unexpected, please check that your API key is correct. If diff --git a/app/sso/templates/sso/serviceaccount/reset.html b/app/sso/templates/sso/serviceaccount/reset.html index 4a7d4ab..d1a5a38 100644 --- a/app/sso/templates/sso/serviceaccount/reset.html +++ b/app/sso/templates/sso/serviceaccount/reset.html @@ -1,18 +1,20 @@ {% extends "base.html" %} -{% block title %}External Service Account Password Reset{% endblock %} +{% block title %}Reset Service{% endblock %} {% block content %} +

This service will reset your password for account {{ acc.service_uid }} on {{ acc.service }}. If you wish to continue please click the link below.

- -{{ form.as_table }} -
-{% csrf_token %} - +
+ {% include "formtools/formfield.html" with field=form.password %} + {% csrf_token %} + +
- {% endblock %} diff --git a/app/sso/views.py b/app/sso/views.py index c7983ef..6b1b8ca 100644 --- a/app/sso/views.py +++ b/app/sso/views.py @@ -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