show.html.haml 4.61 KB
Newer Older
1
- page_title "Account"
2
- header_title page_title, profile_account_path
3
- @blank_container = true
4

5 6
- if current_user.ldap_user?
  .alert.alert-info
7 8
    Some options are unavailable for LDAP accounts

9
.account-page
10 11
  .panel.panel-default.update-token
    .panel-heading
12
      Reset Private token
13
    .panel-body
14 15 16 17 18 19 20 21 22 23 24
      = 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
25 26
              = text_field_tag "token", current_user.private_token, class: "form-control"
              %div
27
                = f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-default btn-build-token"
28 29
            - else
              %span You don`t have one yet. Click generate to fix it.
30
              = f.submit 'Generate', class: "btn btn-default btn-build-token"
31

32
  - unless current_user.ldap_user?
33 34 35 36
    .panel.panel-default
      .panel-heading
        Two-factor Authentication
      .panel-body
37
        - if current_user.two_factor_enabled?
38
          .pull-right
39
            = link_to 'Disable Two-factor Authentication', profile_two_factor_auth_path, method: :delete, class: 'btn btn-close btn-sm',
40
                data: { confirm: 'Are you sure?' }
41 42 43
          %p.text-success
            %strong
              Two-factor Authentication is enabled
44
          %p
45
            If you lose your recovery codes you can
46
            %strong
47
              = succeed ',' do
48
                = link_to 'generate new ones', codes_profile_two_factor_auth_path, method: :post, data: { confirm: 'Are you sure?' }
49
            invalidating all previous codes.
50

51
        - else
52
          %p
53 54 55 56
            Increase your account's security by enabling two-factor authentication (2FA).
          %p
            Each time you log in you’ll be required to provide your username and
            password as usual, plus a randomly-generated code from your phone.
57
          %div
58
            = link_to 'Enable Two-factor Authentication', new_profile_two_factor_auth_path, class: 'btn btn-success'
59

60
  - if button_based_providers.any?
61 62 63 64 65 66
    .panel.panel-default
      .panel-heading
        Connected Accounts
      .panel-body
        .oauth-buttons.append-bottom-10
          %p Click on icon to activate signin with one of the following services
67
          - button_based_providers.each do |provider|
68
            .btn-group
69
              = link_to provider_image_tag(provider), user_omniauth_authorize_path(provider), method: :post, class: "btn btn-lg #{'active' if auth_active?(provider)}", "data-no-turbolink" => "true"
70

71
              - if auth_active?(provider)
72 73
                = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do
                  = icon('close')
74

75
  - if current_user.can_change_username?
76 77
    .panel.panel-warning.update-username
      .panel-heading
78
        Change Username
79 80
      .panel-body
        = form_for @user, url: update_username_profile_path,  method: :put, remote: true do |f|
81
          %p
82 83 84 85 86 87 88 89 90 91 92 93
            Changing your username will change path to all personal projects!
          %div
            = f.text_field :username, required: true, class: 'form-control'
             
          .loading-gif.hide
            %p
              = icon('spinner spin')
              Saving new username
          %p.light
            = user_url(@user)
          %div
            = f.submit 'Save username', class: "btn btn-warning"
94

95
  - if signup_enabled?
96 97
    .panel.panel-danger.remove-account
      .panel-heading
98
        Remove account
99
      .panel-body
100 101 102 103 104 105 106 107 108 109 110 111 112 113
        - if @user.can_be_removed?
          %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
          = link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove"
        - else
          - if @user.solo_owned_groups.present?
            %p
              Your account is currently an owner in these groups:
              %strong #{@user.solo_owned_groups.map(&:name).join(', ')}
            %p
Nicolas's avatar
Nicolas committed
114
              You must transfer ownership or delete these groups before you can delete your account.