Customize django-kerberos autologin to work with authentic2 login page
This commit is contained in:
parent
5f0ed0fc24
commit
9086c0d40f
|
@ -0,0 +1,34 @@
|
|||
{% load staticfiles %}
|
||||
{% if not user.is_authenticated %}
|
||||
<div id="kerberos-autologin">
|
||||
Autologin...
|
||||
<script src="{% static "js/autologin.js" %}" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
autologin('{% url 'kerberos-login' %}', function (ok) {
|
||||
function getQueryVariable(variable) {
|
||||
var query = window.location.search.substring(1);
|
||||
var vars = query.split('&');
|
||||
for (var i = 0; i < vars.length; i++) {
|
||||
var pair = vars[i].split('=');
|
||||
if (decodeURIComponent(pair[0]) == variable) {
|
||||
return decodeURIComponent(pair[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var el = document.getElementById('kerberos-autologin')
|
||||
if (ok) {
|
||||
var next = getQueryVariable('next');
|
||||
if (next) {
|
||||
window.location = next;
|
||||
} else {
|
||||
window.location = '/';
|
||||
}
|
||||
el.innerHtml = 'Logged in, reloading...';
|
||||
} else {
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{% endif %}
|
|
@ -1,6 +1,6 @@
|
|||
{% load i18n %}
|
||||
<div>
|
||||
{% include "django_kerberos/autologin.html" %}
|
||||
{% include "authentic2_auth_kerberos/autologin.html" %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<input type="submit" name="{{ submit_name }}" value="{% trans "Login" %}"/>
|
||||
|
|
Loading…
Reference in New Issue