summaryrefslogtreecommitdiffstats
path: root/template/en/default/account/prefs/mfa.html.tmpl
blob: df272f7d3a60c13add50514800c477449b746ede (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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  #
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
  #%]

[% IF NOT Bugzilla.feature('mfa') %]
  <input type="hidden" name="mfa_action" id="mfa-action" value="">
  <p>
    Two-factor Authentication is not available.
  </p>
  [% RETURN %]
[% END %]
[% IF user.cryptpassword == '*' %]
  <input type="hidden" name="mfa_action" id="mfa-action" value="">
  <p>
    Two-factor Authentication is not available on your account because you are
    using an external authentication provider.
  </p>
  [% RETURN %]
[% END %]

<div id="mfa-container">
  [% IF mfa_recovery_token %]
    <input type="hidden" name="mfa_action" id="mfa-action" value="">

    <p>
      Here are your recovery codes.
    </p>

    [% INCLUDE recovery_blurb %]
    <iframe id="mfa-recovery-frame" tabindex="-1"
            src="userprefs.cgi?tab=mfa&frame=recovery&t=[% mfa_recovery_token FILTER uri %]">
    </iframe>

  [% ELSIF user.mfa %]
    <p>
      Two-factor authentication is currently <b>enabled</b> using
      <b>[% SWITCH user.mfa %]
        [% CASE "TOTP" %]TOTP
      [% END %]</b>.
    </p>
    <input type="hidden" name="mfa_action" id="mfa-action" value="disable">

    <div id="mfa-buttons">
      <div>
        <button type="button" id="mfa-disable">Disable Two-factor Authentication</button>
        [% INCLUDE "mfa/protected.html.tmpl" %]
      </div>
      <div>
        <button type="button" id="mfa-recovery">Generate Printable Recovery Codes</button>
        [% INCLUDE "mfa/protected.html.tmpl" %]
      </div>
    </div>

    <p class="mfa-api-blurb">
      [% IF user.settings.api_key_only.value == 'on' %]
        Enabling two-factor authentication has also required systems that
        interface with [% terms.Bugzilla %]'s API to use <a href="userprefs.cgi?tab=apikey">API keys</a>
        for authentication.<br>
        <br>
        While not recommended, this limitation can be lifted by changing the
        <a href="userprefs.cgi?tab=settings#api_key_only">Require API key authentication for API requests</a>
        preference.
      [% ELSE %]
        Systems that interface with [% terms.Bugzilla %]'s API are not required to use API keys.<br>
        Change the
        <a href="userprefs.cgi?tab=settings#api_key_only">Require API key authentication for API requests</a>
        preference to enforce API key usage.
      [% END %]
    </p>

    <div id="mfa-recovery-container" style="display:none">
      <p>
        Your current password and verification code is required to generate
        recovery codes.
      </p>
      <ul>
        <li><b>Generating recovery codes obsoletes previously generated ones</b></li>
      </ul>
      [% INCLUDE recovery_blurb %]
    </div>

    <div id="mfa-disable-container" style="display:none">
      <p>
        Your current password and verification code is required to disable
        two-factor authentication.
      </p>
    </div>

    <div id="mfa-auth-container" style="display:none">
      <p>
        <label class="mfa-totp">Current Password:</label>
        <input type="password" name="password" id="mfa-password" required>
      </p>

      [% IF user.mfa == "TOTP" %]
        <label class="mfa-totp">Code:</label>
        <input type="text" name="code"
               placeholder="123456" maxlength="9" pattern="\d{6,9}" size="10"
               autocomplete="off" required autofocus>
      [% END %]
    </div>

  [% ELSE %]
    <p>
      Two-factor authentication is currently <b>disabled</b>.
    </p>
    <input type="hidden" name="mfa_action" id="mfa-action" value="enable">
    <input type="hidden" name="mfa" id="mfa">

    <div id="mfa-select">
      <p>
        Select the two-factor system you want to use:
      </p>
      <button type="button" id="mfa-select-totp">Time-based One-Time Password (TOTP)</button>
    </div>

    [%# TOTP %]
    <div id="mfa-enable-totp" class="mfa-provider" style="display:none">

      <p>
        Your current password is required to enable two-factor authentication.
      </p>
      <p>
        <label class="mfa-totp">Current Password:</label>
        <input type="password" name="password" id="mfa-password" required>
      </p>

      <div id="mfa-totp-throbber">
        Generating new QR code.. <img src="skins/standard/throbber.gif" width="16" height="11">
      </div>

      <div id="mfa-totp-issued" style="display:none">
        <iframe id="mfa-enable-totp-frame" src="userprefs.cgi?tab=mfa&frame=totp" tabindex="-1"></iframe>
        <div id="mfa-totp-blurb">
          Scan this QR code with your <a href="#" id="mfa-totp-apps">TOTP App</a>,
          then enter the six digit code the app generates.<br>
          <br>
          <label class="mfa-totp">Code:</label>
          <input type="text" name="code" id="mfa-totp-enable-code"
                  placeholder="123456" maxlength="6" pattern="\d{6}" size="10"
                  autocomplete="off" required autofocus>
        </div>
      </div>

      <p>
        If you have problems enrolling, this may be due to an inaccurate time on your device.<br>
        Please check that the time on your device is accurate by visiting <b>http://time.is/</b>.
      </p>

      <div id="mfa-totp-apps-popup" class="mfa-totp-popup" style="display:none">
        Example TOTP Applications:<br>
        <ul>
          <li>Android and iOS:
            <a href="https://support.google.com/accounts/answer/1066447" target="_blank">Google Authenticator</a>,
            <a href="https://fedorahosted.org/freeotp/" target="_blank">Red Hat FreeOTP</a>
          </li>
          <li>Firefox OS:
            <a href="https://marketplace.firefox.com/app/firekey/" target="_blank">Firekey</a>
          </li>
          <li>Windows Phone:
            <a href="http://www.windowsphone.com/en-us/store/app/authenticator/021dd79f-0598-e011-986b-78e7d1fa76f8"
                target="_blank">Authenticator</a>
          </li>
        </ul>
        <a href="https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm#Client_implementations" target="_blank">
          Other clients
        </a>
        <button type="button" class="mfa-totp-popup-close">Close</button>
      </div>

    </div>

  [% END %]

  <div id="mfa-confirm" style="display:none">
    <p>
      Two-factor authentication settings will not be updated until you
      <b>Submit Changes</b>.
    </p>

    <p class="mfa-api-blurb" style="display:none">
      Enabling two-factor authentication will also require systems that
      interface with [% terms.Bugzilla %]'s API to use <a href="userprefs.cgi?tab=apikey">API keys</a>
      for authentication.  While not recommended, this limitation can be lifted by changing the
      <a href="userprefs.cgi?tab=settings#api_key_only">Require API key authentication for API requests</a>
      preference after 2FA is enabled.
    </p>
  </div>

</div>

[% BLOCK recovery_blurb %]
  <ul>
    <li>These codes can be used in case you lose your second factor</li>
    <li>Please store them safely in a locked cabinet at home</li>
    <li>If in doubt, generate and print new recovery codes</li>
    <li><b>Do not store these codes electronically</b></li>
  </ul>
[% END %]