summaryrefslogtreecommitdiff
path: root/app/views/profiles/two_factor_auths/show.html.haml
blob: ce76cb73c9c82ec214f3bca70e5bf7572cb07500 (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
- page_title 'Two-Factor Authentication', 'Account'
- header_title "Two-Factor Authentication", profile_two_factor_auth_path

.row.prepend-top-default
  .col-lg-3
    %h4.prepend-top-0
      Register Two-Factor Authentication App
    %p
      Use an app on your mobile device to enable two-factor authentication (2FA).
  .col-lg-9
    - if current_user.two_factor_otp_enabled?
      = icon "check inverse", base: "circle", class: "text-success", text: "You've already enabled two-factor authentication using mobile authenticator applications. You can disable it from your account settings page."
    - else
      %p
        Download the Google Authenticator application from App Store or Google Play Store and scan this code.
        More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}.
      .row.append-bottom-10
        .col-md-3
          = raw @qr_code
        .col-md-9
          .account-well
            %p.prepend-top-0.append-bottom-0
              Can't scan the code?
            %p.prepend-top-0.append-bottom-0
              To add the entry manually, provide the following details to the application on your phone.
            %p.prepend-top-0.append-bottom-0
              Account:
              = current_user.email
            %p.prepend-top-0.append-bottom-0
              Key:
              = current_user.otp_secret.scan(/.{4}/).join(' ')
            %p.two-factor-new-manual-content
              Time based: Yes
      = form_tag profile_two_factor_auth_path, method: :post do |f|
        - if @error
          .alert.alert-danger
            = @error
        .form-group
          = label_tag :pin_code, nil, class: "label-light"
          = text_field_tag :pin_code, nil, class: "form-control", required: true
        .prepend-top-default
          = submit_tag 'Register with Two-Factor App', class: 'btn btn-success'

%hr

.row.prepend-top-default

  .col-lg-3
    %h4.prepend-top-0
      Register Universal Two-Factor (U2F) Device
    %p
      Use a hardware device to add the second factor of authentication.
    %p
      As U2F devices are only supported by a few browsers, it's recommended that you set up a
      two-factor authentication app as well as a U2F device so you'll always be able to log in
      using an unsupported browser.
  .col-lg-9
    %p
      - if @registration_key_handles.present?
        = icon "check inverse", base: "circle", class: "text-success", text: "You have #{pluralize(@registration_key_handles.size, 'U2F device')} registered with GitLab."
    - if @u2f_registration.errors.present?
      = form_errors(@u2f_registration)
    = render "u2f/register"

- if two_factor_skippable?
  :javascript
    var button = "<a class='btn btn-xs btn-warning pull-right' data-method='patch' href='#{skip_profile_two_factor_auth_path}'>Configure it later</a>";
    $(".flash-alert").append(button);