aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base/auth/generate_token.html
blob: f7061be4573a68428d45c9a313a1e03b47384398 (plain)
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
[%
INCLUDE 'header.html', title = loc('Security'), bodyclass = 'fullwidthpage'
%]

[% IF token_generated %]

  <div class="confirmation-header">
    <h1>[% loc('Your token has been generated') %]</h1>

    <p>
        <strong>[% loc('Token:') %]</strong>
        <span>[% existing_token | html %]</span>
    </p>

    <p><a href="/my">[% loc('Your account') %]</a></p>
  </div>

[% ELSIF toggle_2fa_on %]

  <div class="confirmation-header">
    <h1>[% loc('Two-factor authentication has been activated') %]</h1>

    <p align="center"><img src="[% qr_code %]"></p>
    <p align="center">[% secret32.replace('(....)', '$1 ') %]</p>

    <p><a href="/my">[% loc('Your account') %]</a></p>
  </div>

[% ELSIF toggle_2fa_off %]

  <div class="confirmation-header">
    <h1>[% loc('Two-factor authentication has been deactivated') %]</h1>

    <p><a href="/my">[% loc('Your account') %]</a></p>
  </div>

[% ELSE %]

<h1>[% loc('Security') %]</h1>

<form action="[% c.uri_for_action('/auth/profile/generate_token') %]" method="post" name="generate_token">
    <input type="hidden" name="token" value="[% csrf_token %]">

    [% IF existing_token %]
        <p>
            <strong>[% loc('Current token:') %]</strong>
            <span>[% existing_token | html %]</span>
        </p>
    [% END %]

    <p>
    <input name="generate_token" type="submit" class="btn" value="[% existing_token ? loc('Replace token') : loc('Generate token') %]">
      [% IF c.user.is_superuser %]
        <input name="toggle_2fa" type="submit" class="btn" value="[% has_2fa ? loc('Deactivate two-factor authentication') : loc('Activate two-factor authentication') %]">
      [% END %]
    </p>
</form>

[% IF existing_token %]
  <p>
  [% loc('If you generate a new token the existing token will no longer work.') %]
  </p>
[% END %]
[% END %]

[% INCLUDE 'footer.html' %]