aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base/auth/generate_token.html
blob: 7654e11ebd5e2b8b013e212989ff886b749c0edc (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
[%
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>[% token_generated %]</span>
    </p>

    <p>
        [% loc('This will be the only time this token is visible, so please make a note of it now.') %]
    </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>

[% ELSIF stage == 'success' %]

  <div class="confirmation-header">
    <h1>[% loc('Two-factor authentication has been activated') %]</h1>
    <p>[% loc('Thanks, you have successfully enabled two-factor authentication on your account.') %]</p>
    <p><a href="/my">[% loc('Your account') %]</a></p>
  </div>

[% ELSIF stage == 'activate' %]
  <div class="confirmation-header confirmation-header--phone">
    <h1>[% loc('Two-factor authentication') %]</h1>

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

[% ELSE %]

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

<form action="[% c.uri_for_action('/auth/profile/generate_token') %]" method="post" name="generate_token">

<h2>[% loc('Two-factor authentication') %]</h2>

    <input type="hidden" name="token" value="[% csrf_token %]">

    <p>
      [% IF c.user.is_superuser || c.user.from_body %]
        [% IF has_2fa %]
        <input name="2fa_activate" type="submit" class="btn" value="[% loc('Change two-factor authentication') %]">
          [% IF !c.cobrand.call_hook('must_have_2fa', c.user) %]
            <input name="2fa_deactivate" type="submit" class="btn" value="[% loc('Deactivate two-factor authentication') %]">
          [% END %]
        [% ELSE %]
        <input name="2fa_activate" type="submit" class="btn" value="[% loc('Activate two-factor authentication') %]">
        [% END %]
      [% END %]
    </p>

<h2>[% loc('Token') %]</h2>

    <input type="hidden" name="token" value="[% csrf_token %]">

    <p>
    <input name="generate_token" type="submit" class="btn" value="[% existing_token ? loc('Replace token') : loc('Generate token') %]">
    </p>

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

</form>
[% END %]

[% INCLUDE 'footer.html' %]