show.html.haml 4.1 KB
Newer Older
D
Douwe Maan 已提交
1
- page_title "Account"
2 3
- if current_user.ldap_user?
  .alert.alert-info
D
Dmitriy Zaporozhets 已提交
4 5
    Some options are unavailable for LDAP accounts

6
.account-page
D
Dmitriy Zaporozhets 已提交
7 8
  %fieldset.update-token
    %legend
9
      Reset Private token
D
Dmitriy Zaporozhets 已提交
10 11 12 13 14 15 16 17 18 19 20 21
    %div
      = form_for @user, url: reset_private_token_profile_path, method: :put do |f|
        .data
          %p
            Your private token is used to access application resources without authentication.
            %br
            It can be used for atom feeds or the API.
            %span.cred
              Keep it secret!

          %p.cgray
            - if current_user.private_token
D
Dmitriy Zaporozhets 已提交
22 23
              = text_field_tag "token", current_user.private_token, class: "form-control"
              %div
24
                = f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-primary btn-build-token"
D
Dmitriy Zaporozhets 已提交
25 26 27 28
            - else
              %span You don`t have one yet. Click generate to fix it.
              = f.submit 'Generate', class: "btn success btn-build-token"

29 30
  - unless current_user.ldap_user?
    %fieldset
31 32 33 34 35
      - if current_user.otp_required_for_login
        %legend.text-success
          %i.fa.fa-check
          Two-Factor Authentication enabled
        %div
36 37
          .pull-right
            = link_to "Disable 2-Factor Authentication", profile_two_factor_auth_path, method: :delete, class: 'btn btn-close btn-sm'
38 39 40 41 42
          %p
            If you lost your recovery codes - you can
            %strong
              = link_to "generate new one", codes_profile_two_factor_auth_path, method: :post,
                data: { confirm: 'After we generate new recovery codes - old codes will not be valid any more. Are you sure?' }
43 44 45 46 47 48 49 50 51 52

      - else
        %legend Two-Factor Authentication
        %div
          %p
            Keep your account secure by enabling two-factor authentication.
            %br
            Each time you log in, you’ll be required to provide your password plus a randomly generated access code.
          %div
            = link_to "Enable 2-Factor Authentication", new_profile_two_factor_auth_path, class: 'btn btn-success'
D
Dmitriy Zaporozhets 已提交
53 54 55

  - if show_profile_social_tab?
    %fieldset
56 57
      %legend Connected Accounts
      .oauth-buttons.append-bottom-10
D
Dmitriy Zaporozhets 已提交
58 59
        %p Click on icon to activate signin with one of the following services
        - enabled_social_providers.each do |provider|
60 61 62 63 64 65
          .btn-group
            = link_to oauth_image_tag(provider), omniauth_authorize_path(User, provider),
              class: "btn btn-lg #{'active' if oauth_active?(provider)}"
            - if oauth_active?(provider)
              = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do
                %i.fa.fa-close
D
Dmitriy Zaporozhets 已提交
66 67 68 69

  - if show_profile_username_tab?
    %fieldset.update-username
      %legend
70
        Change Username
D
Dmitriy Zaporozhets 已提交
71 72
      = form_for @user, url: update_username_profile_path,  method: :put, remote: true do |f|
        %p
J
Jeroen van Baarsen 已提交
73
          Changing your username will change path to all personal projects!
D
Dmitriy Zaporozhets 已提交
74
        %div
D
Dmitriy Zaporozhets 已提交
75
          = f.text_field :username, required: true, class: 'form-control'
D
Dmitriy Zaporozhets 已提交
76
           
77 78
        .loading-gif.hide
          %p
S
Sullivan SENECHAL 已提交
79
            %i.fa.fa-spinner.fa-spin
80
            Saving new username
D
Dmitriy Zaporozhets 已提交
81 82 83
        %p.light
          = user_url(@user)
        %div
S
Sabba Petri 已提交
84
          = f.submit 'Save username', class: "btn btn-warning"
D
Dmitriy Zaporozhets 已提交
85 86 87 88 89 90 91 92 93 94 95 96 97 98

  - if show_profile_remove_tab?
    %fieldset.remove-account
      %legend
        Remove account
      %div
        %p Deleting an account has the following effects:
        %ul
          %li All user content like authored issues, snippets, comments will be removed
          - rp = current_user.personal_projects.count
          - unless rp.zero?
            %li #{pluralize rp, 'personal project'} will be removed and cannot be restored
          - if current_user.solo_owned_groups.present?
            %li
99
              The following groups will be abandoned. You should transfer or remove them:
D
Dmitriy Zaporozhets 已提交
100
              %strong #{current_user.solo_owned_groups.map(&:name).join(', ')}
D
Dmitriy Zaporozhets 已提交
101
        = link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove"
V
Valery Sizov 已提交
102