mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Update sso templates and a few minor issues
This commit is contained in:
@@ -29,7 +29,8 @@ class BaseService():
|
|||||||
|
|
||||||
settings = { 'require_user': True,
|
settings = { 'require_user': True,
|
||||||
'require_password': True,
|
'require_password': True,
|
||||||
'provide_login': False }
|
'provide_login': False,
|
||||||
|
'use_auth_username': True, }
|
||||||
|
|
||||||
def add_user(self, username, password, **kwargs):
|
def add_user(self, username, password, **kwargs):
|
||||||
""" Add a user, returns a dict for that user """
|
""" Add a user, returns a dict for that user """
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block title %}External Auth API Services Password Reset{% endblock %}
|
{% block title %}Change Services Password{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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
|
<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>
|
password below.</p>
|
||||||
|
|
||||||
<form action="{% url sso.views.set_apipasswd %}" method="post">
|
<form action="{% url sso.views.set_apipasswd %}" method="post">
|
||||||
<table>
|
<formset>
|
||||||
{{ form.as_table }}
|
{% include "formtools/formfield.html" with field=form.password %}
|
||||||
</table>
|
{% csrf_token %}
|
||||||
<br />
|
<input type="submit" value="Reset Account" class="btn primary" />
|
||||||
{% csrf_token %}
|
</formset>
|
||||||
<input type="submit" value="Reset Account" />
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<table>
|
{% include "formtools/formfield.html" with field=form.email1 %}
|
||||||
{{ form.as_table }}
|
{% include "formtools/formfield.html" with field=form.email2 %}
|
||||||
</table>
|
{% csrf_token %}
|
||||||
{% csrf_token %}
|
<input type="submit" value="Change Email" class="btn primary"/>
|
||||||
<input type="submit" value="Change Email" class="btn"/>
|
</fieldset>
|
||||||
</fieldset>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -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>
|
<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">
|
<form action="" method="post">
|
||||||
<table>
|
<fieldset>
|
||||||
{{ form.as_table }}
|
{% include "formtools/formfield.html" with field=form.character %}
|
||||||
</table>
|
{% csrf_token %}
|
||||||
<br />
|
<input type="submit" value="Change" class="btn primary" />
|
||||||
{% csrf_token %}
|
</fieldset>
|
||||||
<input type="submit" value="Change" />
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -48,24 +48,26 @@
|
|||||||
<h2>Service Accounts</h2>
|
<h2>Service Accounts</h2>
|
||||||
<p>These are services that cannot talk to auth and require a seperate username/password.</p>
|
<p>These are services that cannot talk to auth and require a seperate username/password.</p>
|
||||||
{% if user.serviceaccount_set.all %}
|
{% if user.serviceaccount_set.all %}
|
||||||
<table>
|
<table class="zebra-striped" id="services">
|
||||||
<tr><th>Service</th><th>Username</th><th>URL</th><th>Active</th><th>Actions</th></tr>
|
<thead>
|
||||||
{% for acc in user.serviceaccount_set.all %}
|
<tr><th>Service</th><th>Username</th><th>URL</th><th>Active</th><th>Actions</th></tr>
|
||||||
<tr><td>{{ acc.service }}</td>
|
</thead>
|
||||||
<td>{{ acc.service_uid }}</td>
|
<tbody>
|
||||||
<td><a href="{{ acc.service.url }}">{{ acc.service.url }}</a></td>
|
{% for acc in user.serviceaccount_set.all %}
|
||||||
<td>{% if acc.active %}Yes{% else %}No{% endif %}</td>
|
<tr><td>{{ acc.service }}</td>
|
||||||
<td>
|
<td>{{ acc.service_uid }}</td>
|
||||||
{% if acc.active %}
|
<td><a href="{{ acc.service.url }}">{{ acc.service.url }}</a></td>
|
||||||
{% if acc.service.settings.require_password %}<a href="{% url sso.views.service_reset acc.id %}">Reset</a> / {% endif %}
|
<td>{% if acc.active %}Yes{% else %}No{% endif %}</td>
|
||||||
<a href="{% url sso.views.service_del acc.id %}">Delete</a>
|
<td>
|
||||||
{% if acc.service.provide_login %}
|
{% if acc.active %}
|
||||||
/ <a href="{% url sso.views.service_login acc.id %}">Login</a>
|
{% if acc.service.settings.require_password %}<a href="{% url sso.views.service_reset acc.id %}">Reset</a> / {% endif %}
|
||||||
{% endif %}
|
<a href="{% url sso.views.service_del acc.id %}">Delete</a>
|
||||||
{% endif %}
|
{% if acc.service.provide_login %} / <a href="{% url sso.views.service_login acc.id %}">Login</a>{% endif %}
|
||||||
</td>
|
{% endif %}
|
||||||
</tr>
|
</td>
|
||||||
{% endfor %}
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>
|
<p>
|
||||||
@@ -93,7 +95,7 @@
|
|||||||
<td>{{ acc.api_user_id }}</td>
|
<td>{{ acc.api_user_id }}</td>
|
||||||
<td>{{ acc.api_key|slice:":10" }}…</td>
|
<td>{{ acc.api_key|slice:":10" }}…</td>
|
||||||
<td>{{ acc.description }}</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 %} <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 %} <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-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 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>,
|
<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>,
|
||||||
@@ -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>
|
<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 %}
|
{% endifswitch %}
|
||||||
</p>
|
</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>
|
</div>
|
||||||
|
|
||||||
{% if "reddit"|installed %}
|
{% if "reddit"|installed %}
|
||||||
@@ -185,22 +159,50 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var el = $(this);
|
var el = $(this);
|
||||||
var id = $(this).attr('id');
|
var id = $(this).attr('id');
|
||||||
$.ajax({
|
if (!el.attr('data-content')) {
|
||||||
type: 'GET',
|
$.ajax({
|
||||||
url: '/eve/eveapi/access/' + id + '/',
|
type: 'GET',
|
||||||
dataType: 'html',
|
url: '/eve/eveapi/access/' + id + '/',
|
||||||
success: function(data) {
|
dataType: 'html',
|
||||||
el.attr('data-content', data);
|
success: function(data) {
|
||||||
el.popover('show');
|
el.attr('data-content', data);
|
||||||
},
|
el.popover('show');
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
el.popover('show');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.tabs').tabs();
|
$('.tabs').tabs();
|
||||||
$("table#eveapikeys").tablesorter({ sortList: [[0,0]] });
|
$("table#eveapikeys").tablesorter({ sortList: [[0,0]] });
|
||||||
$('.accesspopup').popover({html: 'true', trigger: 'manual'});
|
$('.accesspopup').popover({html: 'true', trigger: 'manual'});
|
||||||
$('.accesspopup').hover(access_popover, function () { $(this).popover('hide') });
|
$('.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>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -3,9 +3,12 @@
|
|||||||
{% block title %}Add External Service Account{% endblock %}
|
{% block title %}Add External Service Account{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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
|
<p>To add a service to your account, select the service from the list
|
||||||
below
|
below then provide select a username you wish to use create the account for.
|
||||||
then provide select a username you wish to use create the account for<br/>
|
|
||||||
<br/>
|
<br/>
|
||||||
For details on how to connect to each service, please consult the <a
|
For details on how to connect to each service, please consult the <a
|
||||||
href="http://wiki.dredd.it">wiki</a></p>
|
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
|
<p>If you are missing some services, please check that your API key is
|
||||||
up to date, if so use the "Refresh" function.</p>
|
up to date, if so use the "Refresh" function.</p>
|
||||||
|
|
||||||
<form action="{% url sso.views.service_add serviceid %}" method="post">
|
<form action="{% url sso.views.service_add %}" method="post">
|
||||||
<table>
|
<fieldset>
|
||||||
{{ form.as_table }}
|
{% include "formtools/formfield.html" with field=form.character %}
|
||||||
</table>
|
{% include "formtools/formfield.html" with field=form.service %}
|
||||||
<br />
|
{% include "formtools/formfield.html" with field=form.password %}
|
||||||
<input type="submit" value="Create Account" />
|
{% csrf_token %}
|
||||||
{% csrf_token %}
|
<input type="submit" value="Create Account" />
|
||||||
</form>
|
</fieldset>
|
||||||
<br/>
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
{% block title %}External Service Account{% endblock %}
|
{% block title %}External Service Account{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<h1>Add Service</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div style="border: 1px solid #FF0000; background: #FF7D7D; width: 100%; text-align: center;">
|
<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
|
<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
|
||||||
|
|||||||
@@ -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 %}
|
|
||||||
@@ -3,6 +3,10 @@
|
|||||||
{% block title %}External Service Account{% endblock %}
|
{% block title %}External Service Account{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<div class="page-header">
|
||||||
|
<h1>Add Service</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>You have no services available to add to your account</p>
|
<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
|
<p>If this is unexpected, please check that your API key is correct. If
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block title %}External Service Account Password Reset{% endblock %}
|
{% block title %}Reset Service{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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
|
<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>
|
below.</p>
|
||||||
|
|
||||||
<form action="{% url sso.views.service_reset serviceid %}" method="post">
|
<form action="{% url sso.views.service_reset serviceid %}" method="post">
|
||||||
<table>
|
<fieldset>
|
||||||
{{ form.as_table }}
|
{% include "formtools/formfield.html" with field=form.password %}
|
||||||
</table>
|
{% csrf_token %}
|
||||||
{% csrf_token %}
|
<input type="submit" value="Reset Account" class="btn primary"/>
|
||||||
<input type="submit" value="Reset Account" />
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ def service_add(request):
|
|||||||
else:
|
else:
|
||||||
form = clsform() # An unbound form
|
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
|
@login_required
|
||||||
|
|||||||
Reference in New Issue
Block a user