log all modifications to the iframe_count

This commit is contained in:
Benjamin Dauvergne 2013-12-12 15:41:34 +01:00
parent 406be17fc9
commit 3336920e46
3 changed files with 8 additions and 6 deletions

View File

@ -65,8 +65,8 @@ class AuthSAML2Backend:
import saml2_endpoints
code = '<div>'
code += _('Sending logout to %(pid)s....') % { 'pid': name or provider_id }
code += '<iframe src="%s?provider_id=%s" marginwidth="0" marginheight="0" \
scrolling="no" style="border: none" width="16" height="16" onload="iframe_count -= 1"></iframe></div>' \
code += '''<iframe src="%s?provider_id=%s" marginwidth="0" marginheight="0" \
scrolling="no" style="border: none" width="16" height="16" onload="window.iframe_count -= 1; console.log('decrement iframe_count');"></iframe></div>''' \
% (reverse(saml2_endpoints.sp_slo,
args=[provider_id]), provider_id)
return [ code ]

View File

@ -64,8 +64,8 @@ class SamlBackend(object):
else:
code = '<div>'
code += _('Sending logout to %(name)s....') % { 'name': name or provider_id}
code += '<iframe src="%s?provider_id=%s" marginwidth="0" marginheight="0" \
scrolling="no" style="border: none" width="16" height="16" onload="iframe_count -= 1"></iframe></div>' % \
code += '''<iframe src="%s?provider_id=%s" marginwidth="0" marginheight="0" \
scrolling="no" style="border: none" width="16" height="16" onload="window.iframe_count -= 1;console.log('decrement iframe_count');"></iframe></div>''' % \
(reverse(saml2_endpoints.idp_slo, args=[provider_id]), provider_id)
logger.debug("logout_list: code %r" % code)
result.append(code)

View File

@ -7,7 +7,7 @@
{% block content %}
<script>
var iframe_count = 0;
window.iframe_count = 0;
</script>
<h1>{% trans message %}</h1>
@ -18,8 +18,10 @@
</ul>
<script>
iframe_count += document.getElementsByTagName("iframe").length;
window.iframe_count += document.getElementsByTagName("iframe").length;
console.log('logout iframe count: ' + window.iframe_count);
setInterval(function () {
console.log('logout check iframe count: ' + window.iframe_count);
if (iframe_count == 0) {
window.location = '{{ next_page }}';
}