File: logout-iframe.twig

package info (click to toggle)
simplesamlphp 1.19.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 42,920 kB
  • sloc: php: 202,044; javascript: 14,867; xml: 2,700; sh: 225; perl: 82; makefile: 70; python: 5
file content (123 lines) | stat: -rw-r--r-- 4,799 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{% set pagetitle = 'Logging out...'|trans %}
{% extends "base.twig" %}

{% block preload %}

    <link rel="preload" href="{{ asset('js/logout.js') }}" as="script">
    {%- if type != "init" %}
      {%- set content = '2' %}
      {%- if remaining_services|length == 0 %}
        {%- set content = '0; url=logout-iframe-done.php?id=' ~ auth_state %}
      {%- endif %}

    <meta http-equiv="refresh" content="{{ content }}">
    {% endif %}
{% endblock preload %}

{% block content %}

    <h1>{{ pagetitle }}</h1>
  {%- if terminated_service %}
    {%- set SP = terminated_service['name']|translateFromArray|default('the service'|trans)|e %}

    <p>{% trans %}You are now successfully logged out from {{ SP }}.{% endtrans %}</p>
  {%- endif %}
  {%- if remaining_services %}
    {%- set failed = false  %}
    {%- set remaining = 0 %}
    {%- if remaining_services|length > 0 %}

    <p>{% trans %}You are also logged in on these services:{% endtrans %}</p>
    {%- endif %}

    <div class="custom-restricted-width">
      <ul class="fa-ul">
    {%- for key, sp in remaining_services %}
      {%- set timeout = 5 %}
      {%- set name = sp['metadata']['name']|translateFromArray|default(sp['entityID']) %}
      {%- set icon = 'circle-o-notch'  %}
      {%- if sp['status'] == 'completed' %}
        {%- set icon = 'check-circle' %}
      {%- elseif sp['status'] == 'failed' %}
        {%- set icon = 'exclamation-circle' %}
        {%- set failed = true %}
      {%- elseif (sp['status'] == 'onhold' or sp['status'] == 'inprogress') %}
        {%- set remaining = remaining + 1 %}
      {%- endif %}
      {%- if type == 'nojs' and sp['status'] == 'inprogress' %}
        {%- set icon = icon ~ ' fa-spin' %}
      {%- endif %}

        <li id="sp-{{ key }}" data-id="{{ key }}" data-status="{{ sp['status'] }}"
            {#- #} data-timeout="{{ timeout }}">
          <span class="fa-li"><i id="icon-{{ key }}" class="fa fa-{{ icon }}"></i></span>
          {{ name }}
      {%- if sp['status'] != 'completed' and sp['status'] != 'failed' %}
        {%- if type == 'nojs' %}

          <iframe id="iframe-{{ key }}" class="hidden" src="{{ sp['logoutURL'] }}"></iframe>
        {%- else %}

          <iframe id="iframe-{{ key }}" class="hidden" data-url="{{ sp['logoutURL'] }}"></iframe>
        {%- endif %}
      {%- else %}
        {%- if sp['status'] == 'failed' %}
          ({% trans %}logout is not supported{% endtrans %})
        {%- endif %}
      {%- endif %}

        </li>
    {%- endfor %}

      </ul>
    </div>
    <br>
    <div id="error-message"{% if not failed or type == 'init' %} class="hidden"{% endif %}>
      <div class="message-box error">
        {% trans %}Unable to log out of one or more services. To ensure that all your
        {#- #} sessions are closed, you are encouraged to <i>close your webbrowser</i>.{% endtrans %}
      </div>
    </div>
    <form id="error-form" action="logout-iframe-done.php"
          {%- if (not failed or type == 'init') and remaining %} class="hidden"{% endif %}>
      <input type="hidden" name="id" value="{{ auth_state }}">
      <button type="submit" id="btn-continue" name="ok" class="pure-button pure-button-red">
        {%- trans %}Continue{% endtrans -%}
      </button>
    </form>
    <div id="original-actions"{% if type != 'init' %} class="hidden"{% endif %}>
      <p>{% trans %}Do you want to logout from all the services above?{% endtrans %}</p>
      <div class="pure-button-group two-elements">
        <form id="startform" action="logout-iframe.php">
          <input type="hidden" name="id" value="{{ auth_state }}">
          <noscript>
            <input type="hidden" name="type" value="nojs" id="logout-type-selector">
          </noscript>
          <button type="submit" id="btn-all" name="ok" class="pure-button pure-button-red">
            {%- trans %}Yes, all services{% endtrans -%}
          </button>
        </form>
        <form action="logout-iframe-done.php">
          <input type="hidden" name="id" value="{{ auth_state }}">
          <input type="hidden" name="cancel" value="">
          <button id="btn-cancel" class="pure-button" type="submit">
            {%- if terminated_service %}{% trans %}No, only {{ SP }}{% endtrans %}
            {%- else %}{% trans %}No{% endtrans %}{% endif -%}
          </button>
        </form>
      </div>
    </div>
  {%- else %}
    <form id="error-form" action="logout-iframe-done.php">
      <input type="hidden" name="id" value="{{ auth_state }}">
      <button type="submit" id="btn-continue" name="ok" class="pure-button pure-button-red">
        {%- trans %}Continue{% endtrans -%}
      </button>
    </form>
  {% endif %}
{% endblock %}

{% block postload %}

    <script src="{{ asset('js/logout.js') }}"></script>
{% endblock postload %}